Last active
December 21, 2015 09:28
-
-
Save krambuhl/6284823 to your computer and use it in GitHub Desktop.
Sass responsive grid implimentation
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
$grid-max: 12; | |
$grid-column: 80px; | |
$grid-gutter: 0px; | |
@function gridw ($span: $grid-max, $offset: 0px) { | |
@return ($grid-column * $span) + ($grid-gutter * ($span - 1)) + $offset; | |
} | |
@mixin grid ($span: $grid-max, $offset: 0px) { | |
width: gridw($span, $offset); | |
} | |
@mixin grid-respond ($min: -1, $max: -1, $media: "screen") { | |
$grid: null; | |
@if $min != -1 and $max != -1 { | |
$grid: "only " + $media + " and (min-width: " + gridw($min) + ") and (max-width: " + (gridw($max) - 1) + ")"; | |
} @else if $min == -1 and $max != -1 { | |
$grid: "only " + $media + " and (max-width: " + (gridw($max) - 1) + ")"; | |
} @else if $min != -1 and $max == -1 { | |
$grid: "only " + $media + " and (min-width: " + gridw($min) + ")"; | |
} @else { | |
$grid: "only " + $media; | |
} | |
@media #{$grid} { | |
@content; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
usage: