【发布时间】: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;
}
【问题讨论】: