CSS flex-flow Property

Beginner
6 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The flex-flow property is a shorthand for flex-direction and flex-wrap. It sets the flex container’s main axis and whether items can wrap onto more lines.

Use it on an element with display: flex or inline-flex. The initial value is row nowrap. It is not inherited. You can write one keyword or both, in either order.

Baseline · Widely available.

Basic flex-flow is not deprecated. The newer balance wrap keyword is limited — stick to wrap / nowrap for everyday layouts.

Accessibility.

Reverse values (row-reverse, wrap-reverse, and so on) change visual order only. Prefer reordering HTML when reading order matters.

CSS Syntax

syntax.css
flex-flow: <flex-direction> || <flex-wrap> | initial | inherit;

Common pairs: row wrap, column wrap, row nowrap. One value alone is also valid.

Property Values

ValueDescriptionTry it
row nowrapDefault. Horizontal single line (may overflow)Try it
row wrapHorizontal flow; extra items move to the next lineTry it
column wrapVertical flow; wrap into new columns when height runs outTry it
wrapOnly sets wrap; direction defaults to rowTry it
wrap-reverseWraps, but stacks new lines in the reverse cross directionTry it
initialResets to row nowrapTry it
inheritInherits this property from the parent elementTry it

How to Use flex-flow

One shorthand replaces separate direction and wrap rules.

  1. On the parent, set display: flex.
  2. Set flex-flow to a direction, a wrap mode, or both (for example row wrap).
  3. Give items a basis or width so wrapping has a reason to kick in.
  4. Use align-content when you have spare space across multiple lines.
GoalTypical value
Single-line toolbarrow nowrap
Responsive card / tag rowrow wrap
Tall list that fills columnscolumn wrap (set a height)

Live Preview

Six items, each about one-third wide. Change flex-flow to see wrap vs nowrap (and column wrap).

For column wrap, the preview uses a fixed height so new columns can form.

Flex container
1
2
3
4
5
6

flex-flow: row nowrap

CSS Examples

Each snippet shows only what flex-flow needs: a flex container and item sizes that make wrap visible. Use Try It Yourself for a live editor.

Example 1 — Row Wrap

Let items move to the next line when the row is full.

CSS
<style>
  section {
    display: flex;
    flex-flow: row wrap;
  }

  div {
    width: 32%;
  }
</style>

<section>
  <div>1</div>
  <div>2</div>
  <div>3</div>
  <div>4</div>
  <div>5</div>
  <div>6</div>
</section>
Try It Yourself

How It Works

  1. Enable flex. display: flex creates the container.
  2. Set both parts. row wrap means horizontal main axis + wrapping allowed.
  3. Force a squeeze. Each item is about one-third wide, so six items need two lines.
  4. Result. Items 1–3 sit on line one; 4–6 wrap to line two.

Example 2 — Row Nowrap

Keep everything on one line. Extra items may overflow instead of wrapping.

CSS
<style>
  section {
    display: flex;
    flex-flow: row nowrap;
  }

  div {
    width: 32%;
  }
</style>

<section>
  <div>1</div>
  <div>2</div>
  <div>3</div>
  <div>4</div>
  <div>5</div>
  <div>6</div>
</section>
Try It Yourself

How It Works

  1. Same sizes as before. Items still want about 32% each.
  2. No wrapping. nowrap keeps a single flex line.
  3. Overflow or shrink. Items stay on one line; they may shrink or stick out of the box.
  4. Default behavior. This matches the initial flex-flow value.

Example 3 — Column Wrap

Stack items top to bottom, then start a new column when height is full.

CSS
<style>
  section {
    display: flex;
    flex-flow: column wrap;
    height: 160px;
  }

  div {
    width: 30%;
  }
</style>

<section>
  <div>1</div>
  <div>2</div>
  <div>3</div>
  <div>4</div>
  <div>5</div>
  <div>6</div>
</section>
Try It Yourself

How It Works

  1. Main axis is vertical. column stacks items downward.
  2. Set a height. Without a definite height, column wrap has nowhere to “fill up.”
  3. Allow wrap. When the column is full, the next item starts a new column.
  4. Use case. Newspaper-style lists and tall menus that fill sideways.

Edge Cases & Pitfalls

If wrap does not appear, check item size and container size first.

shorthand

It resets both longhands

Any flex-flow value sets both flex-direction and flex-wrap. Omitted parts fall back to their defaults (row / nowrap).

size

Wrap needs a reason to break

Items that can shrink to fit may never wrap. Give a width, flex-basis, or flex: 0 0 … so lines can fill up.

column

Column wrap needs a height

With column wrap, set a definite height (or max-height) on the container, or wrapping into new columns will not show.

limited

balance is not widely supported

flex-flow: wrap balance is limited. Use plain wrap unless you only target the newest Chromium browsers.

a11y

Reverse still keeps DOM order

row-reverse and wrap-reverse flip the view only. Tab order and screen readers follow the HTML.

Browser Support

flex-flow is a browser CSS shorthand for flex containers. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

flex-flow

Basic direction + wrap values are supported in modern browsers since about September 2015. The balance keyword remains limited.

98% Flex support
Google Chrome 29+
Full support
Mozilla Firefox 28+
Full support
Apple Safari 9+
Full support
Microsoft Edge 12+
Full support
Opera 17+
Full support
Samsung Internet 2+
Full support
Internet Explorer 11
Partial support
flex-flow Widely supported

Bottom line: Safe for production with row/column and wrap/nowrap. Avoid relying on balance for cross-browser sites. It is not a runtime API.

Key Takeaways

  • Role: shorthand for flex-direction + flex-wrap.
  • Default: row nowrap — one horizontal line.
  • Everyday pick: row wrap for responsive cards and tags.
  • One value OK: omitted part uses its longhand default.

One line: flex-flow sets direction and wrap together — usually row wrap when items should break onto new lines.

Frequently Asked Questions

It is a shorthand for flex-direction and flex-wrap. It sets the flex container main axis and whether items can wrap onto multiple lines.
The initial value is row nowrap: items flow horizontally on a single line.
Yes. One direction keyword sets flex-direction and leaves wrap at nowrap. One wrap keyword sets flex-wrap and leaves direction at row.
Use it for card grids, tag lists, and toolbars where items should move to the next line when horizontal space runs out.
No. The balance keyword for flex-wrap is limited (mainly very new Chromium). Prefer wrap for cross-browser work.
Basic flex-flow is Baseline and widely available in modern browsers since about September 2015. It is a browser CSS property for flex containers, not a Node.js feature.

Next: flex-grow

Learn how flex items expand to fill free space along the main axis.

flex-grow tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful