Skip to content

Instantly share code, notes, and snippets.

Created July 3, 2012 13:33
Show Gist options
  • Save anonymous/3039720 to your computer and use it in GitHub Desktop.
Save anonymous/3039720 to your computer and use it in GitHub Desktop.
@import "compass/css3/box-sizing";
@import "compass/utilities/general/clearfix";
$colwidth: 67px;
$gutterwith: 10px;
$colums: 12;
.column {
@include box-sizing(border-box);
padding: 0 $gutterwith;
float:left;
}
.column-container{
@include clearfix;
}
@for $i from 1 through $colums {
.col-#{$i} {
@extend .column;
width: 100% / $colums * $i;
}
}
@mixin column($width: 1) {
$base-class: $col-#{$width};
@if #{$base-class} {
#{$base-class} {
@extend .column;
width: 100% / $colums * $width;
}
}
@extend #{$base-class};
}
@mixin container() {
@extend .column-container;
}
/* tests */
// #alpha
// #one
// #two
// #beta
// #three
// #four
// #five
// #sic
#one{
@include column(4);
background-color:red;
}
#two{
@include column(8);
background-color:green;
}
#alpha{
@include container();
}
#beta{
@include container();
}
#three{
@include column(4);
background-color:blue;
}
#four{
@include column(3);
background-color:yellow;
}
#five{
@include column(5);
background-color:red;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment