IE7 中奇怪的浮动错误
在我正在处理的网页上这里,我有一个主要的div,并且在主要的内部div 和图像 div。粗略地说,重要的 HTML 是:
<div id="wrapper">
<div id="main">
<div class="images">
<p>Content</p>
<div class="clear"></div>
</div>
<p>Text...</p>
<div class="clear"></div>
</div>
</div>
和 CSS:
div#wrapper
{
padding: 10px;
width: 90%;
}
div#main
{
padding: 5px;
}
div.images
{
float: right;
width: 320px;
margin-left: 5px;
}
div.clear
{
height: 0;
clear: both;
}
很抱歉,如果问题的原因不在此处的代码中,但我认为是这样。
问题是,当 images
div 变得比 main
div 的内容大时,wrapper
div 就会失去其左内边距;并且 main
的底部填充增加。该问题似乎只出现在 IE7 中。
On the webpage I'm working on here, I have a main div, and within the main div, and image div. Roughly speaking, the important HTML is:
<div id="wrapper">
<div id="main">
<div class="images">
<p>Content</p>
<div class="clear"></div>
</div>
<p>Text...</p>
<div class="clear"></div>
</div>
</div>
and the CSS:
div#wrapper
{
padding: 10px;
width: 90%;
}
div#main
{
padding: 5px;
}
div.images
{
float: right;
width: 320px;
margin-left: 5px;
}
div.clear
{
height: 0;
clear: both;
}
Apologies if the cause of the problem is not within the code here, but I think it is.
The problem is, when the images
div becomes larges than the content of the main
div, the wrapper
div loses its left padding; and the bottom padding of main
increases. The problem only seems to occur in IE7.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,给出
#main
hasLayout
就可以了。将其放入 IE7 样式表中,它就基本修复了。底部的边框仍然很大,但不太重要。
Turns out that giving
#main
hasLayout
does the trick.Put this in the IE7 stylesheet, and it's pretty much fixed. Still to large a border at the bottom, but not too important.