Skip to content

Instantly share code, notes, and snippets.

@mir4a
Created April 5, 2013 13:29
Show Gist options
  • Save mir4a/5319266 to your computer and use it in GitHub Desktop.
Save mir4a/5319266 to your computer and use it in GitHub Desktop.
Clear floating elements
/* `Clear Floated Elements
----------------------------------------------------------------------------------------------------*/
/* http://sonspring.com/journal/clearing-floats */
.clear {
clear: both;
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0;
}
/* http://www.yuiblog.com/blog/2010/09/27/clearfix-reloaded-overflowhidden-demystified */
.clearfix:before,
.clearfix:after {
content: '\0020';
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0;
}
.clearfix:after {
clear: both;
}
/*
The following zoom:1 rule is specifically for IE6 + IE7.
Move to separate stylesheet if invalid CSS is a problem.
*/
.clearfix {
zoom: 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment