Skip to content

Instantly share code, notes, and snippets.

@imlinus
Last active December 29, 2015 02:19
Show Gist options
  • Save imlinus/7599315 to your computer and use it in GitHub Desktop.
Save imlinus/7599315 to your computer and use it in GitHub Desktop.
Clearfix mixin/placeholder
@mixin clearfix {
*zoom: 1;
&:before,
&:after {
content: "";
display: table;
}
&:after { clear: both; }
}
%clearfix {
@include clearfix;
}
// usage
.main {
width: 80%;
margin: auto;
@extend %clearfix;
}
.sidebar {
float: left;
width: 30%;
}
.content {
float: left;
width: 70%;
}
<div class="main">
<div class="sidebar"></div>
<div class="content"></div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment