Skip to content

Instantly share code, notes, and snippets.

@adamstac
Forked from nathansmith/_clearfix.sass
Created October 4, 2011 02:47
Show Gist options
  • Save adamstac/1260789 to your computer and use it in GitHub Desktop.
Save adamstac/1260789 to your computer and use it in GitHub Desktop.
// `Clearfix
//--------------------------------------------------
// Can be added to other style rules via:
//
// #foobar
// @extend .clearfix
.clearfix
zoom: 1
&:before, &:after
content: '.'
display: block
overflow: hidden
visibility: hidden
font-size: 0
line-height: 0
width: 0
height: 0
&:after
clear: both
.clearfix
zoom: 1
&:before, &:after
content: '.'
display: block
overflow: hidden
visibility: hidden
font-size: 0
line-height: 0
width: 0
height: 0
&:after
clear: both
.test
@extend .clearfix
// Compiles to
.clearfix, .test {
zoom: 1;
}
.clearfix:before, .test:before, .clearfix:after, .test:after {
content: ".";
display: block;
overflow: hidden;
visibility: hidden;
font-size: 0;
line-height: 0;
width: 0;
height: 0;
}
.clearfix:after, .test:after {
clear: both;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment