Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@joshperry
Forked from auniverseaway/_grid.scss
Last active September 15, 2015 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshperry/94841f6f398099890c1c to your computer and use it in GitHub Desktop.
Save joshperry/94841f6f398099890c1c to your computer and use it in GitHub Desktop.
Flexbox Grid System
@mixin grid($count) {
display: flex;
// Add Gutters
&.Gutter {
margin: -1em 0 0 -1em;
>.Cell {
padding: 1em 0 0 1em;
}
}
// Grid Alignment
&.align-top {
align-items: flex-start;
}
&.align-bottom {
align-items: flex-end;
}
&.align-center {
align-items: center;
}
// Cell Sizing
.Cell {
flex: 1;
@for $i from 1 through $count - 1 {
&.col-#{$i} {
flex: 0 0 #{100 * $i/$count}%;
}
}
// Cell Alignment
&.align-top {
align-self: flex-start;
}
&.align-bottom {
align-self: flex-end;
}
&.align-center {
align-self: center;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment