Why does IE7 when clearing a float result in a margin bug?

I have a very simple HTML page (validates as XHTML 1.0 Strict):



Some text...

with the following CSS: .news-result { overflow: hidden; padding: 30px 0 20px; } .news-result h2 { float: left; margin: 0 10px 0 0; } .news-result span.date { margin: 1px 0 0; float : left; } .news-result p { padding: 3px 0 0 0; clear: left; } Rendering this page in IE6 or FF3 render perfectly (the title and the date on a single line, followed by the paragraph). In IE7 however, there is a large space between the title and date, and the paragraph. We have a simple reset that clears every margin and padding on every element. Dropping the float on the date element fixes this problem, as does setting `zoom: 1` on the paragraph or removing `overflow: hidden` on the container, but all are not ideal. Why does a float followed by a paragraph trigger this additional top margin, only on IE7?

以上就是Why does IE7 when clearing a float result in a margin bug?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » CSS3 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准