The Ultimate Flexbox Cheat Sheet
Using Flexbox: Mixing Old and New for the Best Browser Support
By Chris Coyier On Flexbox is pretty awesome and is certainly part of the future of layout. The syntax has changed quite a bit over the past few years, hence the "Old" and "New" syntax. But if we weave together the old, new, and in-between syntaxes, we can get decent browser support. Especially for a simple and probably the most common use case: order-controlled grids #The HTML A semantically meaningless wrapper goes around the three main areas and will set the flexbox context. <div class="page-wrap"><section class="main-content" role="main"> Main content: first in source order </section><nav class="main-nav" role="navigation"> Links </nav><aside class="main-sidebar" role="complementary"> Sidebar </aside></div> The end result looking like this: #Flexbox Context We need to make the container for our columns a flexbox display context. Right away we need to weave the old, new, and tweener syntaxes together. #Controlling Column Widths Our goal here is a 20% / 60% / 20% grid. #Column Re-Ordering
Flexy Boxes — CSS flexbox playground and code generation tool
Flexbox browser support Three versions of the flexbox spec – each with different syntax – have been implemented in browsers. The two 2012 specs are roughly equivilant in terms of features, differing mainly in syntax. The earlier 2009 spec is less comprehensive though covers a lot of the same ground. Flexbox 2012 — W3C Candidate Recommendation, September 2012 Opera 12.1+, Firefox 22+. More browser support info available on caniuse.com. Known issues Flexbox early 2012 Flexbox early 2012 (Internet Explorer 10) align-content (equiv. flex-line-pack) doesn't work if the cross axis dimension is set with min-width or min-height Flexbox 2009 Box wrapping is not supported. box-lines is the property in this spec to achieve wrapping, though unfortunately no browser implemented it. Flexbox 2009 (Firefox) Firefox has a number of non-trivial issues with its 2009 implementation: The setting display: box is treated as display: inline-box if there is no width set. Further reading Code and design by @pete_b.
Flexbox Defense
Related:
Related: