treevis

February 2008 Archive

Clearfix is Dead, Long Live Clearfix

The peeps at Nclud came up with a revision to the clearfix method of clearing floats.

.clear {
display:inline-block; /* or anything that triggers hasLayout in IE */
}
.clear:after {
clear:both;
display:block;
content: “.”;
height:0;
visibility:hidden;
}

Valid CSS 2.1 and a bit cleaner than the current clearfix method.