/ Published in: CSS
URL: http://webjournal.nerdfiles.net/2012/12/31/benefits-of-noclass-css/
Based on various grid systems.
Expand |
Embed | Plain Text
/** * Simple 960 Grid System * * Adjust grid_width (max width), grid_col (total columns), and * grid_gut (gutter) to perfection. * * @note: Consider base-8 widths for optimal image rendering; * or golden ratios; or Villard Diagrams for perspective grids. * * @see: http://smashingmagazine.com/2010/02/09/applying-mathematics-to-web-design/, * http://thegridsystem.org/tags/golden-ratio/, * http://danielecapo.com/wp/2009/05/04/villard-diagram/, * http://code.google.com/p/the-golden-grid/ * * @usage: div.grid-12>div.row>(div.columns-6+div.columns+6), etc. */ /* Core Settings */ $grid_width : 960px; $grid_col : 12; $grid_gut : 20px; body { min-width: $grid_width; } /* Grid Container */ .grid-#{$grid_col} { margin-left: auto; margin-right: auto; width: $grid_width; /* Grid System Classes */ @for $i from 1 through $grid_col { .columns-#{$i} { display: inline; float: left; margin-left: $grid_gut / 2; margin-right: $grid_gut / 2; } .push-#{$i}, .pull-#{$i} { position: relative; } .columns-#{$i} { width: ( ($grid_width / $grid_col - $grid_gut) * $i ) + (($i - 1) * $grid_gut); } .prefix-#{$i} { padding-left: $grid_width / $grid_col * $i; } .suffix-#{$i} { padding-right: $grid_width / $grid_col * $i; } .push-#{$i} { left: $grid_width / $grid_col * $i; } .pull-#{$i} { right: $grid_width / $grid_col * $i; } } .row { zoom: 1; &:before, &:after { content: ""; display: table; } &:after { clear: both; } } /* Grid Resets */ .alpha { margin-left: 0; } // no left margin .omega { margin-right: 0; } // no right margin /* Grid System Mixins */ @mixin row() { @extend .row; } @mixin columns($col: 1) { @extend .columns-#{$col}; } @mixin push($col: 1) { @extend .push-#{$col}; } @mixin pull($col: 1) { @extend .pull-#{$col}; } @mixin prefix($col: 1) { @extend .prefix-#{$col}; } @mixin suffix($col: 1) { @extend .suffix-#{$grid_col}; } @mixin alpha() { @extend .alpha; } @mixin omega() { @extend .omega; } }// Grid Container
You need to login to post a comment.
