【发布时间】:2013-01-26 18:36:49
【问题描述】:
我在 IE7 中遇到问题。我创建了以下 html 来演示可能的“问题”。
HTML:
<div id="container">
<div id="head">
</div>
<div id="left">
</div>
<div id="right">
</div>
<div id="no-float">
</div>
</div>
CSS:
#container {
width:200px;
height:200px;
margin: 0 auto;
background-color:#555555;
}
#head {
width:200px;
height:20px;
background-color:black;
float:left;
}
#left {
width:100px;
height:40px;
background-color:blue;
float:left;
}
#right {
width:100px;
height:40px;
background-color:red;
float:left;
}
#no-float {
width:20px;
height:20px;
position:relative;
background-color:green;
}
现在我希望绿色的无浮动 div 位于容器的最左上角,因为据我了解,正常内容应该完全忽略浮动内容。这在我测试过的所有浏览器中都可以正常工作,而不是在 IE7 中。这是我对浮点数的理解有问题还是 IE7 中的错误?如果这是一个错误,谁能指出我正确的方向来修复它?这是问题的一个jsfiddle。
【问题讨论】:
-
IE 是纯粹的邪恶。 jsfiddle.net/vQhAN/1 这行得通,但我知道这不是答案
-
不敢相信这对我来说毫无意义!
-
是的,但不能在 firefox 中工作;] 只是说 IE+relative = pure evil
-
是的。也不能在 chrome 中工作,所以不能修复,只是奇怪!
-
尝试在绿色上进行绝对定位,在容器上进行相对定位。我没有IE7可以测试。 jsfiddle.net/vQhAN/6
标签: css internet-explorer internet-explorer-7 css-float