Created
February 25, 2012 21:24
-
-
Save greypants/1910904 to your computer and use it in GitHub Desktop.
SCSS: Basic SCSS Grid System
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
/* @group SCSS Grid */ | |
$column-width: 45px; | |
$gutter-width: 16px; | |
@mixin col-width($span){ | |
width: ($column-width + $gutter-width) * $span - $gutter-width; | |
} | |
@mixin col-offset($span){ | |
margin-left: ($column-width + ($gutter-width * 2)) * $span - $gutter-width; | |
} | |
.grid { | |
margin-right: -#{$gutter-width}; | |
[class*="span"] { | |
float: left; | |
margin-right: $gutter-width; | |
} | |
@for $i from 1 through 16 { | |
.span#{$i} { | |
@include col-width($i); | |
} | |
.offset#{$i} { | |
@include col-offset($i); | |
} | |
} | |
} | |
/* @end */ |
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
<div class="grid"> | |
<div class="row"> | |
<div class="span6"> | |
</div> | |
<div class="span9 offset1"> | |
</div> | |
</div> | |
<div class="row"> | |
<div class="span8"> | |
</div> | |
<div class="span8"> | |
</div> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment