Skip to content

Instantly share code, notes, and snippets.

@yatil
Created October 11, 2011 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yatil/1278555 to your computer and use it in GitHub Desktop.
Save yatil/1278555 to your computer and use it in GitHub Desktop.
My columnar SCSS file
$columnsmax: 16;
$columnwidth: 40px;
$gutterwidth: 20px;
$widthmax: ($columnsmax * $columnwidth) + (($columnsmax - 1) * $gutterwidth);
@function grid($cols: 1) {
$width: ($cols * $columnwidth) + (($cols - 1) * $gutterwidth);
@return percentage($width/$widthmax);
}
@function gutter() {
@return percentage($gutterwidth/$widthmax);
}
@function gridgutter($cols: 1) {
@return gutter() + grid($cols);
}
@function innergrid($outercols:1, $innercols:1) {
$columnsinnerpx: ($innercols * $columnwidth) + (($innercols - 1) * $gutterwidth);
$columnsouterpx: ($outercols * $columnwidth) + (($outercols - 1) * $gutterwidth);
@return percentage($columnsinnerpx/$columnsouterpx);
}
@function innergutter($outercols:1) {
$columnsouterpx: ($outercols * $columnwidth) + (($outercols - 1) * $gutterwidth);
@return percentage($gutterwidth/$columnsouterpx);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment