Created
September 26, 2012 01:45
-
-
Save cyjake/3785514 to your computer and use it in GitHub Desktop.
Implement Brix Grid in SCSS
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
$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