我创建了一个div,并在其中添加了2个div:
<div id="content">
<div id="a"></div>
<div id="b"></div>
</div>和样式:
#content {
width:100px;
height:100px;
background-color:blue;
}
#a, #b {
position:relative;
top:0px;
left:0px;
width:100px;
height:100px;
background-color:red;
}
#b {
top:-100px;
background-color:green;
}在Firefox中,我得到了一个100x100的绿色“盒子”,但在IE中,"content“div高于100px ( 200px高),你可以在绿色下面看到蓝色的”盒子“。
有没有可能强制"content“div到100px的高度?
发布于 2009-08-06 16:32:38
#content {
width:100px;
height:100px;
background-color:blue;
overflow:hidden;
}发布于 2009-08-06 16:48:06
在#content div上尝试overflow:hidden或overflow:auto,看看这样做是否能得到想要的结果。您可能还希望在您的div上发出填充:0px;和:0px;div。
https://stackoverflow.com/questions/1240040
复制相似问题