Skip to content

Instantly share code, notes, and snippets.

@martdn
Created March 14, 2016 09:38
Show Gist options
  • Save martdn/591d9b39920b33c6b89b to your computer and use it in GitHub Desktop.
Save martdn/591d9b39920b33c6b89b to your computer and use it in GitHub Desktop.
example scss - Grid
@mixin grid(
$width: 960px,
$gutter: 20px,
$columns : 12,
$prefix: true,
$push: true
) {
$column_width: $width/$columns;
.grid {
display: inline;
float: left;
margin-left: $gutter / 2;
margin-right: $gutter / 2;
}
@for $i from 1 through $columns {
.grid_#{$i} {
@extend .grid;
width: $i * $column_width - $gutter;
}
@if $prefix == true {
.prefix_#{$i}{
padding-left: $i * $column_width;
}
.suffix_#{$i}{
padding-right: $i * $column_width;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment