Try adding a clearer one:
<div id="main"> <div id="left"></div> <div id="right"></div> <div style="clear:both"></div> <div id="footer"></div> </div>
When the css clear element is set to both , it will not allow the ANY FLOATING element to overlap at its border and text area, which means that the margin can overlap with float elements. That is why you do not see the border of the footer. So we basically need an extra div that doesn't float, so the edge of your footer is pushing something. Try my codes below (with BG and Borders), you will see what I say.
No extra div:
<div id="main"> <div id="left" style="background:#FF000;border:solid 1px #000000;float:left">LEFT</div> <div id="right" style="background:#00FF00;border:solid 1px #000000;float:right">RIGHT</div> <div id="footer" style="clear:both;margin-top:10px;background:#00FFFF;border:solid 1px #000000;">FOOTER</div> </div>
With an extra div:
<div id="main"> <div id="left" style="background:#FF000;border:solid 1px #000000;float:left">LEFT</div> <div id="right" style="background:#00FF00;border:solid 1px #000000;float:right">RIGHT</div> <div style="background:#0000FF;border:solid 1px #000000;clear:both">CLEARER</div> <div id="footer" style="margin-top:10px;background:#00FFFF;border:solid 1px #000000;">FOOTER</div> </div>
Resource:
http://www.w3.org/TR/CSS2/visuren.html#flow-control
source share