I have a very simple HTML page (validates as XHTML 1.0 Strict):
<div class="news-result">
<h2><a href="#">Title</a></h2><span class="date">(1-1-2009)</span>
<p>Some text...</p>
</div>
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?