【问题标题】:Overflow scroll has overflow hidden溢出滚动已隐藏溢出
【发布时间】:2014-03-19 01:23:39
【问题描述】:

我有一个 div 可滚动内容,其中有一个应该溢出其父级的标题。 似乎溢出:滚动将溢出:隐藏添加到元素。
如果你能帮助我,我将不胜感激。谢谢!

HTML:

<div class="container">
    <div class="problem">This is hidden</div>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
</div>

<div class="container container-2">
    <div class="problem">This is what i want, but scrollable.</div>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
    <p>Content</p>
</div>

CSS:

.container {
    width: 230px;
    height: 200px;
    background-color: #eeeeee;
    overflow-y: scroll;
    margin-top: 30px;
    margin-left: 30px;
    float: left;
}

.container-2 {
    overflow-y: visible;
}

.problem {
    width: 235px;
    height: 30px;
    background-color: #33CCFF;
    margin-left: -20px;
    margin-top: 15px;
}

【问题讨论】:

    标签: html css overflow


    【解决方案1】:
    .problem {
        width: 235px;
        height: 30px;
        background-color: #33CCFF;
        /*margin-left: -20px;*/  //this is the cause of problem comment this
        margin-top: 15px;
    }
    

    Demo Fiddle

    【讨论】:

    • 我的想法是,我希望蓝色 div 稍微超出其父级,就像在最后一个中一样,但在第一个中,溢出隐藏了它。
    • @LucaBoieru 喜欢第二个在右边,或者你想要它在左边
    • 我希望蓝色的div在左边(见第二个例子的原始代码)
    猜你喜欢
    • 2017-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-21
    • 2013-02-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多