Skip to content

Instantly share code, notes, and snippets.

@zeusdeux
Created October 3, 2015 17:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zeusdeux/c752856b1945645b9e7c to your computer and use it in GitHub Desktop.
Save zeusdeux/c752856b1945645b9e7c to your computer and use it in GitHub Desktop.
flexbox based simple grid system
/* 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