Skip to content

Instantly share code, notes, and snippets.

@advitum
Last active August 29, 2015 14:04
Show Gist options
  • Save advitum/624a0b6e683e17c3222c to your computer and use it in GitHub Desktop.
Save advitum/624a0b6e683e17c3222c to your computer and use it in GitHub Desktop.
SCSS grid system using box-sizing
$columnCount: 12;
$columnWidth: 64px;
$gutterWidth: 20px;
@mixin clear {
&::after {
content: "";
width: 100%;
height: 0px;
display: block;
clear: both;
}
}
@mixin container {
@include clear;
width: $columnCount * ($columnWidth + $gutterWidth);
margin: 0px auto;
}
@mixin grid($n) {
@include box-sizing(border-box);
padding-left: $gutterWidth * .5;
padding-right: $gutterWidth * .5;
width: $n * ($columnWidth + $gutterWidth);
float: left;
}
@mixin prefix($n) {
margin-left: $n * ($columnWidth + $gutterWidth);
}
@mixin suffix($n) {
margin-right: $n * ($columnWidth + $gutterWidth);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment