Created
October 3, 2015 17:22
-
-
Save zeusdeux/c752856b1945645b9e7c to your computer and use it in GitHub Desktop.
flexbox based simple grid system
This file contains 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
/* Simple flexbox based grid system */ | |
$columns: 12; | |
@mixin layout-cols($device) { | |
@for $i from 1 through 12 { | |
.l-#{$device}-col-#{$i} { | |
flex: 0 0 $i / $columns * 100%; | |
} | |
} | |
} | |
@mixin responsify { | |
/* Common rules */ | |
.l-container { | |
margin-left: auto; | |
margin-right: auto; | |
.row { | |
display: flex; | |
flex-wrap: wrap; | |
flex-direction: row; | |
justify-content: center; | |
@include layout-cols(d); | |
} | |
} | |
/* Tablet rules */ | |
@media only screen | |
and (max-width: 768px) { | |
.l-container { | |
.row { | |
@include layout-cols(t); | |
} | |
} | |
} | |
/* Mobile rules */ | |
@media only screen | |
and (max-width: 480px) { | |
.l-container{ | |
.row { | |
@include layout-cols(m); | |
} | |
} | |
} | |
} | |
@include responsify; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment