Last active
September 7, 2015 05:47
-
-
Save jefflau/ae36e3444c2ce43f79a0 to your computer and use it in GitHub Desktop.
Stylus Grid Mixin using calc() to create grids with percentage widths, but pixel based gutters
This file contains 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
grid($columns, $gutter) | |
$width = 100% /$columns; | |
$marginDeficit = $gutter * ($columns - 1) / $columns; | |
float: left; | |
width: "calc(%s - %s)" % ($width $marginDeficit); | |
margin-right: $gutter | |
&:nth-child({$columns}n) | |
margin-right: 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment