Skip to content

Instantly share code, notes, and snippets.

@jlong
Created August 14, 2012 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlong/3353289 to your computer and use it in GitHub Desktop.
Save jlong/3353289 to your computer and use it in GitHub Desktop.
Grids
// Grids
=grids($max-columns: 10)
#{enumerate(".grid", 2, $max-columns)}
+clearfix
@for $columns from 2 through $max-columns
.grid-#{$columns}
+grid($columns)
#{enumerate('.span', 1, $max-columns)}
> *:first-child
margin-top: 0 !important
#{enumerate('.grid', 2, $max-columns)}
.clear
clear: left
.right
text-align: right
float: right
.center
text-align: center
.last
margin-right: 0 !important
// A simple grid mixin
=grid($columns: 2)
$column-width: floor(1 / $columns * 100%)
+box-sizing(border-box)
#{enumerate('.span', 1, $columns)}
float: left
+box-sizing(border-box)
@for $n from 1 through $columns
.span-#{$n}
width: $column-width * $n
.offset-#{$n}
margin-left: $column-width * $n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment