Created
May 21, 2017 23:10
-
-
Save rendfall/6cd7687008baf280c8c69efcb3d1b149 to your computer and use it in GitHub Desktop.
Simple 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
@mixin element($e) { | |
&__#{$e} { @content; } | |
} | |
@mixin modifier($e) { | |
&--#{$e} { @content; } | |
} | |
.grid { | |
$gutter: 30px; | |
$items-in-row: 2; | |
$basis: 100% * (1 / $items-in-row); | |
@include element('row') { | |
display: flex; | |
flex-flow: row wrap; | |
justify-content: space-between; | |
margin-left: -1 * $gutter; | |
margin-right: -1 * $gutter; | |
} | |
@include element('item') { | |
flex: 1 0 $basis; | |
padding: 0 $gutter; | |
@include modifier('pull-top') { | |
align-self: flex-start; | |
} | |
@include modifier('pull-bottom') { | |
align-self: flex-end; | |
} | |
@include modifier('pull-middle') { | |
align-self: center; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment