Created
August 15, 2011 01:49
-
-
Save plasticine/1145584 to your computer and use it in GitHub Desktop.
Generate a grid.
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
$grid_col_names:( | |
'one', 'two', 'three', 'four', 'five', 'six', | |
'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve' | |
); | |
@function col($count:1){ @return (($grid_col_width + $grid_gutter) * $count) - $grid_gutter; } | |
@mixin pre_col($count:1){ margin-left: col($count); } | |
@mixin post_col($count:1){ margin-right: col($count); } | |
@mixin make_grid_classes{ | |
@for $index from 1 through $grid_num_cols { | |
.grid-#{nth($grid_col_names, $index)} { | |
width: col($index); | |
float:left; | |
margin-right:$grid_gutter; | |
outline:1px solid #eee; | |
} | |
.grid-pre-#{nth($grid_col_names, $index)} { @include pre_col($index); } | |
.grid-post-#{nth($grid_col_names, $index)} { @include post_col($index); } | |
} | |
.grid-last{ margin-right:0; } | |
} | |
@mixin grid{ | |
margin:0 auto; | |
width:col($grid_num_cols); | |
@include make_grid_classes; | |
} | |
.grid{ @include grid; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment