我有一个具有以下样式的div
#holder{
margin-top: 1px;
background-color: #DCE1E5;
position:absolute;
left:0;
right:0;
display:block;
padding:8px;
}
我的问题是我在这个 div 标签之后输入的任何元素都隐藏在 div 后面
<div id="holder">My Stuff here of</div>
<div id="somethingelse">This will be hidden behind the top div</div>
关于如何解决此问题并让它与 IE7 兼容有什么想法吗?
最佳答案
position: absolute; 从盒模型定义的流中移除元素。任何小于 holder 的元素都会被它隐藏。对于这种情况,解决方案是不要使用 position: absolute;,因为我知道您并不是真的想要通过它可以实现的东西。
我建议您花点时间了解什么是盒子模型:http://www.w3.org/TR/CSS2/box.html
关于html - DIV position absolute 导致隐藏div之后的其他元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16088907/