Skip to content

Instantly share code, notes, and snippets.

@AdmireNL
Last active August 29, 2015 14:09
Show Gist options
  • Save AdmireNL/0cbca42f53b56148b331 to your computer and use it in GitHub Desktop.
Save AdmireNL/0cbca42f53b56148b331 to your computer and use it in GitHub Desktop.
Column span mixin
// ----
// Sass (v3.4.7)
// Compass (v1.0.1)
// ----
$total-columns: 12;
$column-width: 60px;
$gutter-width: 20px;
@mixin column-span($columns) {
// Output width property and take padding into account.
width: $columns * ($column-width + $gutter-width);
padding: 0 ($gutter-width / 2);
}
.wrap {
width: $total-columns * ($column-width + $gutter-width);
}
article {
@include column-span(8);
}
aside {
@include column-span(4);
}
.wrap {
width: 960px;
}
article {
width: 640px;
padding: 0 10px;
}
aside {
width: 320px;
padding: 0 10px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment