mdvata
Last Updated: February 25, 2016
·
3.272K
· ultimatedelman
0e2e822d32a7ab3d7f0b7098d03b1d16

SASS/Compass Mixin For Flexbox (New and Legacy)

Flexbox is awesome, and I find it sad that many developers aren't using it. Reasons range from "it's too hard" to "it's not fully supported yet" to "I don't want to support both specs!" Well, I made it pretty easy for you.

I built a SASS/Compass mixin (well, series of mixins) that enables a developer to very easily build a flexbox layout using the new syntax that will automatically translate your values into the legacy format to support browsers that haven't quite caught up with the spec. It's as simple as:

.container {
    @include flexcontainer;
}
.child {
    @include flexchild;
}

Of course there are many configurable properties and a helper flexprop() mixin for single properties. The mixin will create all the necessary code for legacy support and will translate the spec-based properties into IE's weird proprietary properties.

Say Thanks
Respond