Last active
August 29, 2015 14:06
-
-
Save pixelbacon/7bad836c843b34632975 to your computer and use it in GitHub Desktop.
Simple columns in Sass
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 set-columns($numCols, $margin:0, $padding-sides:0) { | |
$afterPadding: 100% - (($numCols - 1) * $margin); | |
float: left; | |
width: $afterPadding/$numCols; | |
margin-right: $margin; | |
padding-left: $padding-sides/2; | |
padding-right: $padding-sides/2; | |
&:nth-of-type(#{$numCols}n + #{$numCols}) { | |
margin-right: 0; | |
} | |
&:nth-of-type(#{$numCols}n - #{($numCols * 2) - 1}) { | |
clear: both; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment