Created
September 24, 2014 08:08
-
-
Save Sam152/14524c1c3c7375ec343b to your computer and use it in GitHub Desktop.
Simple grids
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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