Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Sass: Flex layout w/ Float layout fall back.

Warning: Work in progress :)

I decided to create some @mixins which will help with creating Flex layouts, while offering support to older browsers.

The goal was to help me understand the flex property, then I got a little carried away with creating the fallbacks. I also created a fallback for Firefox, as it doesn't support the "flex-wrap" property just yet.

Disclaimer: Modernizr has a slight bug, and doesn't detect flexbox on Firefox, as it presents the no-flexbox. In the Firefox fallback code I have used both ".flexbox &" ".no-flexbox &". This isn't quite semantic, but I will update when Modernizr 3 is released.

http://codepen.io/boostnewmedia/pen/hlseE

I will be working on making the Sass code just a little bit more tidy.

2 Answers

James Barnett
James Barnett
39,199 Points

You could use bourbon to simplify your prefixes

Hey James,

I will look into that, thanks.

Question, is that just another Mixin file that is populated with all the different prefixes?

James Barnett
James Barnett
39,199 Points

Bourbon is installed as a Ruby gem and then SCSS files are imported which include mixins.