Created
November 16, 2012 10:40
-
-
Save cjbell/4086312 to your computer and use it in GitHub Desktop.
Simple grid
This file contains hidden or 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
$container-width: 960; | |
$num-columns: 24; | |
$column-width: 30; | |
$gutter-width: ($container-width - $num-columns * $column-width) / $num_columns; | |
$container-px-width: $container-width * 1px; | |
$column-px-width: $column-width * 1px; | |
$column-pct-width: ($column-width / $container-width) * 100%; | |
$gutter-px-width: $gutter-width * 1px; | |
$gutter-pct-width: ($gutter-width / $container-width) * 100%; | |
@mixin container { | |
width: 90%; | |
max-width: $container-px-width + $gutter-px-width; | |
margin: 0 auto; | |
/* Keep the container centered. */ | |
position: relative; | |
left: $gutter-pct-width / 2; | |
@include clearfix; | |
} | |
@mixin cols($cols:$num-columns) { | |
width: $column-pct-width * $cols + $gutter-pct-width * ($cols - 1); | |
margin-right: $gutter-pct-width; | |
float: left; | |
@media screen and (max-width: 480px) { | |
width: 100% - $gutter-pct-width; | |
margin-bottom: 1em; | |
} | |
} | |
@mixin respond-480($cols) { | |
@media screen and (max-width: 480px) { @include cols($cols); } | |
} | |
@mixin respond-760($cols) { | |
@media screen and (max-width: 760px) { @include cols($cols); } | |
} | |
@mixin respond-960($cols) { | |
@media screen and (max-width: 960px) { @include cols($cols); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment