Created
February 5, 2015 13:48
-
-
Save evgkirov/0fcccfd831c177e8ecbc to your computer and use it in GitHub Desktop.
Responsive grid for Stylus
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
columns ?= 12 | |
gutter-width ?= 20px | |
breakpoints ?= 480px | |
column-width() | |
return (100% / columns) | |
row() | |
+cache('grid-row') | |
clearfix() | |
box-sizing: border-box | |
margin-left: - gutter-width | |
column(x, xresp...) | |
+cache('grid-column') | |
box-sizing: border-box | |
display: block | |
float: left | |
padding-left: gutter-width | |
width: column-width() * x | |
for x, i in xresp | |
@media screen and (max-width: breakpoints[i]) | |
width: column-width() * x | |
offset(x, xresp...) | |
+cache('grid-offset-' + join('-', arguments)) | |
margin-left: column-width() * x | |
for x, i in xresp | |
@media screen and (max-width: breakpoints[i]) | |
margin-left: column-width() * x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment