Categories
Web

A new and better clearfix

I love clearfix. It works great, but now there is a new sheriff in town.

This is micro clearfix. For those of you not familiar with clearfix, when you have child elements that are all floated, the parent element has no “shape” to hold its height. Clearfix takes care of that.

http://nicolasgallagher.com/micro-clearfix-hack/

 

/* For modern browsers */
.cf:before,
.cf:after {
    content:"";
    display:table;
}

.cf:after {
    clear:both;
}

/* For IE 6/7 (trigger hasLayout) */
.cf {
    zoom:1;
}