Skip to content

Instantly share code, notes, and snippets.

@irae
Created November 21, 2010 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save irae/708294 to your computer and use it in GitHub Desktop.
Save irae/708294 to your computer and use it in GitHub Desktop.
The better way to clearfix ever!
/* The Magnificent CLEARFIX: Updated to prevent margin-collapsing on child elements << j.mp/bestclearfix */
/* Fix clearfix: blueprintcss.lighthouseapp.com/projects/15318/tickets/5-extra-margin-padding-bottom-of-page */
/* Note: It's better to use display:inline-block; if width is set on the element you want to clear */
.clearfix:before, .clearfix:after {
content: "\0020"; display: block; height: 0; visibility: hidden;
}
.clearfix:after { clear: both; }
.clearfix { zoom: 1; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment