Skip to content

Instantly share code, notes, and snippets.

@lesjames
Created May 9, 2012 20:13
Show Gist options
  • Save lesjames/2648490 to your computer and use it in GitHub Desktop.
Save lesjames/2648490 to your computer and use it in GitHub Desktop.
Modified Griddle
// function for converting px to em
@function em($px, $base: 16px) { @return (($px / $base) * 1em); }
// column width functions
@function fixed($col) { @return (($col * (em($grid-column) + em($grid-gutter)) - em($grid-gutter))) }
@function fluid($col, $avail) { @return (100% / $avail) * $col; }
// =========================================================
// breakpoint mixin
// =========================================================
@mixin breakpoint($col, $sandbox: false) {
@if ($sandbox) {
@if ($col == 0) {
@media (max-width: (fixed($sandbox) + (em($grid-gutter) * 2))) { @content }
} @else {
@media (min-width: (fixed($col) + (em($grid-gutter) * 2))) and (max-width: (fixed($sandbox) + (em($grid-gutter) * 2))) { @content }
}
} @else {
@media (min-width: (fixed($col) + (em($grid-gutter) * 2))) { @content }
}
}
@include breakpoint(8) {
.wrapper { width: fixed(8); }
.user-rail { width: fluid(2, 8); }
.content-rail { width: fluid(6, 8); }
.tile { width: fluid(1, 2); }
}
@include breakpoint(11) {
.wrapper { width: fixed(11); }
.user-rail { width: fluid(2, 11); }
.content-rail { width: fluid(9, 11); }
.tile { width: fluid(1, 3); }
}
@media (min-width: 48.75em) {
.wrapper {
width: 46.25em;
}
.user-rail {
width: 25%;
}
.content-rail {
width: 75%;
}
.tile {
width: 50%;
}
}
@media (min-width: 66.563em) {
.wrapper {
width: 64.063em;
}
.user-rail {
width: 18.182%;
}
.content-rail {
width: 81.818%;
}
.tile {
width: 33.333%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment