html - 溢出滚动已 overflow hidden

标签 html css overflow

我有一个 div 可滚动内容,其中是一个应该溢出其父级的标题。 好像overflow: scroll 给元素添加了overflow: hidden。
如果你能帮助我,我将不胜感激。谢谢!

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;
}

最佳答案

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

Demo Fiddle

关于html - 溢出滚动已 overflow hidden ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22046664/

相关文章:

javascript - 在鼠标悬停时淡化嵌入的 img 或目标特定类

php - 在 jQuery 中设置?

HTML 和 CSS : grey overlay background on full responsive image with text

java - 存储非常大的数组

android - 即使在 deleteLocalRef 之后,jni 表也会溢出

c# - WebUtility.HtmlDecode 与 HttpUtilty.HtmlDecode

javascript - 根据标题宽度设置 html 表格列的宽度

css - 如何使 flex 元素可滚动且内容溢出,列

javascript - Bootstrap 轮播变得困惑

jquery - 使用 materializecss 时 CheckBox 不呈现