Skip to content

Instantly share code, notes, and snippets.

@evgkirov
Created February 5, 2015 13:48
Show Gist options
  • Save evgkirov/0fcccfd831c177e8ecbc to your computer and use it in GitHub Desktop.
Save evgkirov/0fcccfd831c177e8ecbc to your computer and use it in GitHub Desktop.
Responsive grid for Stylus
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