CSS Hacks

Clearfix Hacks

Micro Clearfix Hack

/*
Micro Clearfix Hack
Firefox 3.5+, Safari 4+, Chrome, Opera 9+, IE 6+
@see http://nicolasgallagher.com/micro-clearfix-hack/
*/
.cf:before,
.cf:after {
    content: " ";
    display: table;
}
.cf:after {
    clear: both;
}
.cf {
    zoom: 1;/* For IE 6/7 (trigger hasLayout) */
}

/*.float-content-fix {
    background-color: yellow;
    clear: both;
    float: left;
    height: 10px;
    outline: 1px solid blue;
    width: 100%;
}*/
~~~~~

### Clearfix Reloaded

/* Clearfix Reloaded IE 5.0+ @see http://www.yuiblog.com/blog/2010/09/27/clearfix-reloaded-overflowhidden-demystified/ / .clearfix:before, .clearfix:after { content: “.”; display: block;
height: 0;
overflow: hidden; } .clearfix:after { clear: both; } .clearfix { *zoom: 1;/
IE < 8 */ }


### New Clearfix Hack

/* New Clearfix Hack @see http://perishablepress.com/press/2009/12/06/new-clearfix-hack/ / .clearfix:after { content: ” “; clear: both; display: block; font-size: 0; height: 0; visibility: hidden; } * html .clearfix{ zoom: 1; } / IE6 / *:first-child+html .clearfix { zoom: 1; } / IE7 */


### Float Content Fix

.float-content-fix { background-color: yellow; clear: both; float: left; height: 10px; outline: 1px solid blue; width: 100%; } ~~~~