Last active
August 29, 2015 14:04
-
-
Save advitum/624a0b6e683e17c3222c to your computer and use it in GitHub Desktop.
SCSS grid system using box-sizing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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