Skip to content

Instantly share code, notes, and snippets.

@mannieschumpert
Created April 2, 2013 14:23
Show Gist options
  • Save mannieschumpert/5292588 to your computer and use it in GitHub Desktop.
Save mannieschumpert/5292588 to your computer and use it in GitHub Desktop.
$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