Self Clearing Floats in CSS
Saturday, November 15th, 2008This is a quickie mainly to remind myself. My friend and fellow Fudge developer, Mike “1312” Byrne showed me a CSS trick to have divs clear themselves.
div#container
{
height: 1%;
}
div#container:after
{
content: “.”;
display: block;
height: 0;
clear: both;
visibility: hidden;
}
Brilliant. This works in Safari, Firefox and IE6+ as far as I know.


