The flex-flow Shorthand
You'll learn how to combine flex-direction and flex-wrap into a single, cleaner CSS property.
What is flex-flow?
Just like background or font, CSS offers shorthand properties that bundle related settings together. flex-flow is one of these shortcuts—it lets you set both flex-direction and flex-wrap in a single line instead of writing two separate declarations.
Think of it like ordering a combo meal instead of ordering each item separately. You're getting the same thing, just more efficiently.
The Syntax
.container {
flex-flow: <flex-direction> <flex-wrap>;
}
You write the flex-direction value first, followed by the flex-wrap value. Both are separated by a space.
Common Examples
Instead of this:
.container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
You can write this:
.container {
display: flex;
flex-flow: row wrap;
}
Other combinations work too:
flex-flow: column nowrap;
flex-flow: row-reverse wrap;
flex-flow: column-reverse wrap;
Why Use It?
Using flex-flow makes your code more compact and easier to scan. When you see flex-flow: row wrap, you immediately understand both how items flow (in rows) and what happens when they run out of space (they wrap to new lines). It's a small quality-of-life improvement that keeps your stylesheets tidy.
Key Takeaway: flex-flow is a shorthand property that combines flex-direction and flex-wrap into one declaration, making your flexbox code more concise without changing behavior.