Skip to content

Instantly share code, notes, and snippets.

@Sam152
Created September 24, 2014 08:08
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 Sam152/14524c1c3c7375ec343b to your computer and use it in GitHub Desktop.
Save Sam152/14524c1c3c7375ec343b to your computer and use it in GitHub Desktop.
Simple grids
@mixin grid($columns, $item-selector: '.views-row', $padding: 15px) {
margin: 0 (-1 * ($padding/2));
@include clearfix;
#{$item_selector} {
padding: {
left: $padding / 2;
right: $padding / 2;
}
float: left;
@include box-sizing(border-box);
width: 100%/ $columns;
&:nth-child(#{$columns}n+1) {
clear: both;
}
}
}
// More efficiently update a grid system for responsive.
@mixin grid-update($columns, $item-selector: '.views-row') {
#{$item_selector} {
width: 100%/$columns;
&:nth-child(n) {
clear: none;
}
&:nth-child(#{$columns}n+1) {
clear: both;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment