Stats

1075 Contributors: 18
2017-04-19
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook

Flexible Box Layout (Flexbox)

Download css eBook

Introduction

The Flexible Box module, or just 'flexbox' for short, is a box model designed for user interfaces, and it allows users to align and distribute space among items in a container such that elements behave predictably when the page layout must accommodate different, unknown screen sizes. A flex container expands items to fill available space and shrinks them to prevent overflow.

Syntax

  • display: flex;
  • flex-direction: row | row-reverse | column | column-reverse;
  • flex-wrap: nowrap | wrap | wrap-reverse;
  • flex-flow: <'flex-direction'> || <'flex-wrap'>
  • justify-content: flex-start | flex-end | center | space-between | space-around;
  • align-items: flex-start | flex-end | center | baseline | stretch;
  • align-content: flex-start | flex-end | center | space-between | space-around | stretch;
  • order: <integer>;
  • flex-grow: <number>; /* default 0 */
  • flex-shrink: <number>; /* default 1 */
  • flex-basis: <length> | auto; /* default auto */
  • flex: none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]
  • align-self: auto | flex-start | flex-end | center | baseline | stretch;

Remarks

Vender Prefixes

  • display: -webkit-box; /* Chrome <20 */
  • display: -webkit-flex; /* Chrome 20+ */
  • display: -moz-box; /* Firefox */
  • display: -ms-flexbox; /* IE */
  • display: flex; /* Modern browsers */

Resources

Related Examples