I have a fairly straight forward layout - main div, which floats left. Within it I nest other div's with style clear both. Here is a simplified version(all items have sub-divs):
<div id="wrapper" class="floatLeft">
<div id="mainMenu" class="clearBoth">
<div id="item1" class="clearBoth">
</div>
<div id="item2" class="clearBoth">
</div>
<div id="item3" class="clearBoth">
</div>
</div>
</div>
.clearBoth {
clear: both;
}
.floatLeft {
float: left;
}
Problem is item3's height is computed to be 0 for whatever reason. All the elements within it spill out into the wrapper div. It looks horrible because main menu div has a background etc. If I add style of "overflow:hidden" to item 3 it looks fine - the question is why? I don't understand why is there an overflow? Most importantly though - why is the height of item3 computed to be 0?
Here is a link to jsfiddle http://jsfiddle.net/uPtCd/