/* SASS implementation of the Deco Grid System * For the original, see */ // Modify these to your needs. $prefix: ''; // e.g. 'deco-' $cols: 12; $margin: 2.08333%; @mixin row { float: left; width: 100%; display: block; position: relative; clear: both; } @mixin cell { position: relative; float: left; left: 100%; } // Width mixin. @mixin width($n) { width: $n * (100% + $margin) / $cols - $margin; } // Positioning mixin, this is subtracting from a rightmost // position, which is why it seem the wrong way around @mixin position($n) { margin-left: -100% + $n * (100% + $margin) / $cols; } // create classes .#{$prefix}row {@include row} .#{$prefix}cell {@include cell} @for $n from 1 through $cols { .#{$prefix}width-#{$n} {@include width($n)} .#{$prefix}position-#{$n - 1} {@include position($n - 1)} }