Skip to content

Instantly share code, notes, and snippets.

@afahy
Created April 23, 2013 16:08
Show Gist options
  • Save afahy/5444961 to your computer and use it in GitHub Desktop.
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.
@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