Created
July 19, 2013 16:55
-
-
Save gavinmcfarland/6040673 to your computer and use it in GitHub Desktop.
A mixin that works out all the percentages for your grid. Just specify how many columns it's has and how big you want the gutter (in percentages) to be.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @mixin grid($columns, $gutter) { | |
| @if $columns > 1 { | |
| $fWidth: (1/$columns * 100%) - ($gutter * ($columns - 1) / $columns); | |
| @include clearfix; | |
| > li { | |
| width: #{$fWidth}; | |
| box-sizing: border-box; | |
| float: left; | |
| margin-left: $gutter; | |
| &:nth-child(#{$columns}n + 1) { | |
| margin-left: 0; | |
| clear: both; | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment