Skip to content

Instantly share code, notes, and snippets.

@moreguppy
Last active August 29, 2015 14:11
Show Gist options
  • Save moreguppy/a7ce880b31044e5513fd to your computer and use it in GitHub Desktop.
Save moreguppy/a7ce880b31044e5513fd to your computer and use it in GitHub Desktop.
Using flexbox for centered floaty layouts
/*
Notes:
- Using bourbon.io
- Currently only supported down to IE10 :(
- This was helpful <http://jonibologna.com/flexbox-cheatsheet/>
- Bourbon flex docs <http://bourbon.io/docs/#flexbox>
*/
.flex--container {
@include display(flex);
@include flex-direction(row);
@include justify-content(space-around);
@include align-items(center);
.flex--child {
@include flex(1);
}
.flex--teen {
@include flex(3)
}
}
/*
Example markup:
---------------------------------
<div class="flex--container">
<div class="flex--child">
:)
</div>
<div class="flex--teex">
;)
</div>
<div class="flex--child">
:o
</div>
</div>
Example layout:
------------------------------------
| |
:) | ;) | :o
| |
------------------------------------
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment