CSS Reference ยท Flexbox
The flex-flow property
Reference for the CSS flex-flow shorthand: set flex-direction and flex-wrap in one declaration, with accepted orders, defaults and live examples.
The flex-flow property is a shorthand that sets flex-direction and flex-wrap together. Both describe the "flow" of a flex container: which way items run, and whether they may start a new line when they run out of room.
The two values can be written in either order. Anything you leave out is reset to its initial value.
CSS
.tags { display: flex; flex-flow: row wrap; } .stack { display: flex; flex-flow: column nowrap; }
Try it
Syntax
CSS
flex-flow: <'flex-direction'> || <'flex-wrap'>; flex-flow: row; flex-flow: column wrap; flex-flow: wrap-reverse column-reverse;
- Initial value:
row nowrap - Applies to: flex containers
- Inherited: no
- Animatable: no
- Computed value: as each longhand
Values
| Value | Description |
|---|---|
row, row-reverse, column, column-reverse |
Sets flex-direction. See flex-direction. |
nowrap, wrap, wrap-reverse |
Sets flex-wrap. See flex-wrap. |
Usage notes
- Omitted parts reset.
flex-flow: wrapsets the direction back torow, even if an earlier rule saidcolumn. Use the longhands when you only want to change one of them. - Order does not matter.
row wrapandwrap roware the same. - No separate rows and columns. Unlike
gap,flex-flowis not about the two axes of space. It is about direction and wrapping. - Wrapping needs a limit. Items only wrap if the container has a limited main size. A row container inside a wide parent may never need to wrap. For a column container, give it a height.
- Wrapped lines are independent. Each line distributes its own free space, so items in different lines do not line up in columns. Use Grid when you need that.
Browser support
Supported in every browser.
Related
flex-direction,flex-wrapalign-contentโ aligns wrapped linesgap- Lesson: Flex container properties