Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
adaptation of The 1KB CSS Grid to sass (http://www.1kbgrid.com/). I love Sass
/* adaptation of The 1KB CSS Grid to sass (http://www.1kbgrid.com/). I love Sass.
// To use:
@import 1kbgrid.sass
+1kbgrid(12, 60px, 10px)
=1kbgrid(!num_columns = 12, !column_width = 60px, !gutter = 10px)
// calculated values
!gutter_margin = !gutter / 2
!total_column_width = !column_width + !gutter
!row_width = !total_column_width * !num_columns
@for !i from 1 through !num_columns
.grid_#{!i}
width = (!total_column_width * !i) - !gutter
.column
margin = 0 !gutter_margin
overflow: hidden
float: left
display: inline
.row
width = !row_width
margin: 0 auto
overflow: hidden
.row
margin = 0 -!gutter_margin
width: auto
display: inline-block
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.