Skip to content

Instantly share code, notes, and snippets.

@krambuhl
Last active August 29, 2015 14:05
Show Gist options
  • Save krambuhl/4d2862f8d9822de68547 to your computer and use it in GitHub Desktop.
Save krambuhl/4d2862f8d9822de68547 to your computer and use it in GitHub Desktop.
updated grid version using respond.scss general media query maker
$grid-max: 12;
$grid-column: 80px;
$grid-gutter: 0;
@function gridw ($span: $grid-max, $offset: 0) {
@if $span != -1 {
@return ($grid-column * $span) + ($grid-gutter * ($span - 1)) + $offset;
}
@return -1;
}
@mixin grid ($span: $grid-max, $offset: 0) {
width: gridw($span, $offset);
}
@mixin grid-respond ($min: -1, $max: -1, $media: "all") {
// mixin from respond.scss
// https://gist.github.com/krambuhl/9dd229f391aceb3012b4
@include respond(gridw($min), gridw($max), $media) { @content };
}
@krambuhl
Copy link
Author

krambuhl commented Aug 7, 2014

how to use:

@include grid-respond(0, 6) { 
    body { background: blue; }
}

@include grid-respond(6, 9) { 
    body { background: red; }
}

@include grid-respond(9, 12) {
    body { background: pink; }
}

@include grid-respond(12) {
    body { background: green; }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment