Skip to content

Instantly share code, notes, and snippets.

@alireza-saberi
Created February 27, 2017 16:32
Show Gist options
  • Save alireza-saberi/387d8e88e7ff7989508c17a547443926 to your computer and use it in GitHub Desktop.
Save alireza-saberi/387d8e88e7ff7989508c17a547443926 to your computer and use it in GitHub Desktop.
The clearfix allows a container to wrap it's floated children. Without a clearfix or equivalent styling, a container does not wrap around its floated children and collapses, just as if its floated chldren were positioned absolutely.
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
/* CSS rule for IE6 */
* html .clearfix {
height: 1%;
}
/* CSS rule for IE7 */
*:first-child+html .clearfix {
min-height: 1px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment