A
B
C
D
E
F
As stated before, the flex-flow property is shorthand for the flex-direction and the flex-wrap properties. You can see how to use this to put a flex item dead center in a flex container. The values for these two properties are:
The flex-direction property specifies the direction of the flexible items. Possible values are:
|
The flex-wrap property specifies whether the flexible items should wrap or not. Possible values are:
|
In the example below, we use the flex-flow shortcut to make the flexible items display in reverse order, and also to wrap if necessary:
HTML file: | Displayed by browser: |
---|---|
<style>
#main { width: 200px; height: 200px; border: 1px solid #c3c3c3; display: -webkit-flex; /* Safari */ display: flex; -webkit-flex-flow: row-reverse wrap; /* Safari 6.1+ */ flex-flow: row-reverse wrap; } #main div { width: 50px; height: 50px; } </style> <body> <div id="main"> <div style="background-color:coral;">A</div> <div style="background-color:lightblue;">B</div> <div style="background-color:khaki;">C</div> <div style="background-color:pink;">D</div> <div style="background-color:lightgrey;">E</div> <div style="background-color:lightgreen;">F</div> </div> </body> |
A
B
C
D
E
F
|
Note: If the elements are not flexible items, the flex-flow property has no effect.