Created
April 2, 2013 14:23
-
-
Save mannieschumpert/5292588 to your computer and use it in GitHub Desktop.
.sass syntax grid system from http://viget.com/inspire/building-a-nested-responsive-grid-with-sass-compass
This file contains hidden or 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
$cols: 12 | |
$gutter: 2% | |
$one_col: (100% - ($gutter * ($cols - 1))) / $cols | |
@mixin cols($num) | |
width: ($one_col * $num) + ($gutter * ($num - 1)) | |
@mixin sub_cols($num_child, $num_parent) | |
$parent_size: ($one_col * $num_parent) + ($gutter * ($num_parent - 1)) | |
$child_size: ($one_col * $num_child) + ($gutter * ($num_child - 1)) | |
margin-left: ($gutter / $parent_size) * 100% | |
width: ($child_size / $parent_size) * 100% | |
.row | |
#{enumerate('.span', 1, $cols, '')} | |
float: left | |
margin-left: $gutter | |
@for $i from 1 through $cols | |
.span#{$i} | |
@include cols($i) | |
@for $j from 1 through ($i - 1) | |
.span#{$j} | |
@include sub_cols($j, $i) | |
> :first-child, .row > :first-child | |
margin-left: 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment