Skip to content

Instantly share code, notes, and snippets.

@cyjake
Created September 26, 2012 01:45
Show Gist options
  • Save cyjake/3785514 to your computer and use it in GitHub Desktop.
Save cyjake/3785514 to your computer and use it in GitHub Desktop.
Implement Brix Grid in SCSS
$gridGutterWidth: 10px;
$gridColumnWidth: 10px;
$gridColumns: 50;
$gridRowWidth: ($gridColumns * $gridColumnWidth) + ($gridGutterWidth * ($gridColumns - 1));
.row {
margin-left: $gridGutterWidth * -1;
*zoom: 1;
&:before,
&:after {
display: table;
content: "";
}
&:after {
clear: both;
}
}
@mixin span($columns ) {
width: ($gridColumnWidth * $columns) + ($gridGutterWidth * ($columns - 1));
}
@for $i from 1 through $gridColumns {
.span#{$i} {
float: left;
_display: inline;
margin-left: $gridGutterWidth;
@include span($i);
}
}
@for $i from 1 through $gridColumns {
.offset#{$i} {
margin-left: ($gridColumnWidth * $i) + ($gridGutterWidth * ($i - 1));
}
}
.container {
@include span($gridColumns);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment