-
-
Save zmsaunders/a3d621e708fd43f46724bdf1f38ced66 to your computer and use it in GitHub Desktop.
Bourbon/Neat Flexbox Grid
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
/* | |
Based on code by Kevin Lamping | |
source: http://codepen.io/klamping/pen/waMOeX | |
*/ | |
@mixin flex-grid { | |
display: flex; | |
flex-wrap: wrap; | |
margin-left: -$gutter; | |
margin-top: -$gutter; | |
} | |
@mixin flex-item($min-width, $max-cols) { | |
flex: 1 0 $min-width; | |
margin-left: $gutter; | |
margin-top: $gutter; | |
box-sizing: border-box; | |
@for $i from 2 through $max-cols { | |
$screen-width: ($min-width*$i)+($gutter*$i); | |
$column-width: (100%/$i); | |
@media (min-width: $screen-width) { | |
max-width: calc(#{$column-width} - #{$gutter}); | |
} | |
} | |
$column-width: (100%/$max-cols); | |
@media (min-width: $min-width*$max-cols) { | |
min-width: calc(#{$column-width} - #{$gutter}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment