我有一个 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/