Best Clearfix Ever
I can't remember exactly where I found this, but it is awesome.
.clearfix {
zoom: 1;
clear: both;
}
.clearfix:before, .clearfix:after {
content: "\0020";
display: block;
height: 0;
overflow: hidden;
}
.clearfix:after {
clear: both;
}
Written by Shane McDonald
Related protips
2 Responses
This is very similar to the clearfix in the HTML5 Boilerplate, I think this must be from one of the older version. The latest one currently looks like this
.clearfix:before,
.clearfix:after {
content: " ";
display: table;
}
.clearfix:after {
clear: both;
}
/*
* For IE 6/7 only
* Include this rule to trigger hasLayout and contain floats.
*/
.clearfix {
*zoom: 1;
}
It can be found here with a better explanation: https://github.com/h5bp/html5-boilerplate/blob/master/css/main.css
over 1 year ago
·
@neutraltone Awesome, thanks for sharing!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Css
Authors
Related Tags
#css
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#