Created
April 23, 2013 16:08
-
-
Save afahy/5444961 to your computer and use it in GitHub Desktop.
Flexible box model based grid ala bootstrap's grid semantics (`.container`, `.row`, `.span{n}`). Can set number of cols to be something other than 12.
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
@import "compass/utilities/general/clearfix"; | |
@import "compass/css3/box"; | |
@import "compass/css3/box-sizing"; | |
$num-cols: 12; | |
.container { | |
@include pie-clearfix; | |
margin-right: auto; | |
margin-left: auto; | |
} | |
.row { | |
@include display-box; | |
margin-right: -15px; | |
margin-left: -15px; | |
} | |
*[class*='span'] { | |
@include box-sizing(border-box); | |
} | |
%margins { | |
padding-right: 15px; | |
padding-left: 15px; | |
min-height: 1px; | |
} | |
$i: 1; | |
@while $i <= $num-cols { | |
$percent: $i / $num-cols; | |
.span#{$i} { | |
@extend %margins; | |
width: $percent; | |
} | |
.offset#{$i} { | |
margin-left: $percent; | |
} | |
$i: $i + 1; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment