Skip to content

Instantly share code, notes, and snippets.

@JeffreyWay
Created December 15, 2011 16:34
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save JeffreyWay/1481756 to your computer and use it in GitHub Desktop.
Save JeffreyWay/1481756 to your computer and use it in GitHub Desktop.
Simple CSS Grid in Stylus
full_width = 80
columns = 12
gutter = 1
.container
width unit(full_width, '%')
margin auto
overflow hidden
div[class^="grid_"]
display inline
float left
margin-left unit(gutter, '%')
margin-right unit(gutter, '%')
for col in 1..columns
.grid_{col}
width unit((col / columns - gutter / 100 * 2) * 100, '%')
@media screen and (max-width: 480px)
div[class^="grid_"]
float none
display block
width 100%
margin 0
@JeffreyWay
Copy link
Author

@adesignl
Copy link

This is pretty slick. What are you using SCSS? or a different one? Very simple to read. and understand. I personally love these small grids over the gigantic "do everything" grid systems.

@JeffreyWay
Copy link
Author

I'm using a preprocessor, called Stylus. http://learnboost.github.com/stylus/

@adesignl
Copy link

is Stylus only for node.js or can it be used like less?

@skippednote
Copy link

@adesigni Try to use Google.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment