The flex-flow
property is a sub-property of the Flexible Box Layout module.
It is a shorthand for flex-direction
and flex-wrap
.
Syntax
flex-flow: <%u2018flex-direction%u2019> || <%u2018flex-wrap%u2019> .flex-container { flex-flow: row wrap; }
You can specify one or two values, no matter the order.
Demo
Both lists behave in the exact same way:
- The blue one has
flex-direction: row
andflex-wrap: wrap
- The red one has
flex-flow: row wrap
<h1>flex-wrap: wrap; flex-direction: row;</h1> <ul class="flex-container longhand"> <li class="flex-item">1</li> <li class="flex-item">2</li> <li class="flex-item">3</li> <li class="flex-item">4</li> </ul> <h1>flex-flow: row wrap;</h1> <ul class="flex-container shorthand"> <li class="flex-item">1</li> <li class="flex-item">2</li> <li class="flex-item">3</li> <li class="flex-item">4</li> </ul>
.flex-container { padding: 0; margin: 0; list-style: none; -ms-box-orient: horizontal; display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -moz-flex; display: -webkit-flex; display: flex; } h1 { padding-left: .5em; } .shorthand { -webkit-flex-wrap: wrap; flex-wrap: wrap; -webkit-flex-direction: row; flex-direction: row; } .longhand { -webkit-flex-flow: wrap row; flex-flow: wrap row; } .longhand li { background: deepskyblue; } .flex-item { background: tomato; padding: 5px; width: 100px; height: 100px; margin: 10px; line-height: 100px; color: white; font-weight: bold; font-size: 2em; text-align: center; }
Related Properties
Browser Support
- (modern) means the recent syntax from the specification (e.g. display: flex;)
- (hybrid) means an odd unofficial syntax from 2011 (e.g. display: flexbox;)
- (old) means the old syntax from 2009 (e.g. display: box;)
Chrome | Safari | Firefox | Opera | IE | Android | iOS |
---|---|---|---|---|---|---|
21+ (modern) 20- (old) |
3.1+ (old) | 2-21 (old) 22+ (new) |
12.1+ (modern) | 10+ (hybrid) | 2.1+ (old) | 3.2+ (old) |
Blackberry browser 10+ supports the new syntax.
Leave a Reply