CSS flex-flow Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Flexbox

What You’ll Learn

The flex-flow property is a shorthand that sets both flex-direction and flex-wrap in one line. It is a quick way to control how flex items flow and whether they wrap onto new lines.

01

Shorthand

Direction + wrap.

02

Default

row nowrap.

03

row wrap

Responsive grids.

04

column wrap

Multi-column flow.

05

Container

On flex parent.

06

Less CSS

One property.

Introduction

The flex-flow property in CSS is a shorthand property that combines the flex-direction and flex-wrap properties. It defines the direction in which flex items are placed in the flex container and whether they should wrap onto multiple lines.

This property is useful for creating flexible and responsive layouts without needing to write multiple lines of CSS.

Definition and Usage

Apply flex-flow on a flex container alongside display: flex. Use row wrap for tag clouds and card grids, column nowrap for vertical stacks, and column wrap when items should fill columns before moving to the next column.

💡
Beginner Tip

flex-flow: row wrap is the same as writing flex-direction: row; and flex-wrap: wrap; on separate lines.

📝 Syntax

The syntax for the flex-flow property is as follows:

syntax.css
element {
  flex-flow: flex-direction flex-wrap;
}
  • flex-direction — Specifies the direction of the flexible items.
  • flex-wrap — Specifies whether the flexible items should wrap or not.

Basic Example

flex-flow-wrap.css
.container {
  display: flex;
  flex-flow: row wrap;
}
flex-flow: row nowrap; flex-flow: row wrap; flex-flow: column wrap; flex-flow: wrap;

Default Value

The default value for the flex-flow property is row nowrap, which means the flex items are placed in a single line in the row direction.

Syntax Rules

  • Apply on the flex container, not on flex items.
  • Order can be direction wrap or wrap direction — the browser detects which is which.
  • Omitting wrap defaults to nowrap; omitting direction defaults to row.
  • The property is not inherited.
  • Use gap for spacing between wrapped items instead of margins when possible.

⚡ Quick Reference

QuestionAnswer
Initial valuerow nowrap
Applies toFlex containers
InheritedNo
Shorthand forflex-direction + flex-wrap
Common responsive valuerow wrap

💎 Property Values

flex-flow accepts values from both flex-direction and flex-wrap:

flex-direction values

ValueDescription
rowItems are placed in a row (default).
row-reverseItems are placed in a row, but in reverse order.
columnItems are placed in a column.
column-reverseItems are placed in a column, but in reverse order.

flex-wrap values

ValueDescription
nowrapAll flex items will be on one line (default).
wrapFlex items will wrap onto multiple lines, from top to bottom.
wrap-reverseFlex items will wrap onto multiple lines, from bottom to top.

Common flex-flow Combinations

flex-flowEquivalent longhandTypical use
row nowrapDefault horizontal toolbarNav bars, button groups
row wrapHorizontal with line breaksCard grids, tags, chips
column nowrapVertical single columnSidebar menus, stacked forms
column wrapVertical with column breaksMasonry-style column layouts

👀 Live Preview

Six items with flex-flow: row wrap — they wrap to the next line when space runs out:

1 2 3 4 5 6

Examples Gallery

In this example, we’ll create a flex container with items that wrap onto multiple lines and are arranged in a column — plus row wrap grids, default nowrap, and a tag list.

🔀 Direction & Wrapping

Start with the reference example — column direction with wrapping enabled.

Example 1 — Column Wrap Layout

Stack items vertically and allow them to wrap into new columns when the container height is limited.

flex-flow-column-wrap.html
<style>
  .container {
    display: flex;
    flex-flow: column wrap;
    height: 200px;
  }
  .item {
    width: 100px;
    height: 50px;
    background-color: lightcoral;
  }
</style>

<div class="container">
  <div class="item">Item 1</div>
  <!-- items 2–6 -->
</div>
Try It Yourself

How It Works

Items flow top to bottom. When the 200px height fills up, wrapping creates a new column to the right.

Example 2 — Row Wrap Card Grid

The most common pattern: horizontal flow with wrapping for responsive card layouts.

flex-flow-row-wrap.css
.cards {
  display: flex;
  flex-flow: row wrap;
  gap: 1rem;
}
Try It Yourself

How It Works

Cards sit in a row until the container is too narrow, then wrap to the next line automatically.

📌 Nowrap & Tag Layouts

Keep items on one line or build flexible tag lists with wrapping.

Example 3 — Row Nowrap (Default)

Keep all toolbar buttons on a single horizontal line with the default row nowrap behavior.

flex-flow-nowrap.css
.toolbar {
  display: flex;
  flex-flow: row nowrap;
  gap: 0.5rem;
}
Try It Yourself

How It Works

With nowrap, items stay on one line. Overflow may scroll horizontally if the container is too narrow.

Example 4 — Wrapping Tag List

Build a flexible tag cloud where labels wrap naturally with flex-flow: row wrap.

flex-flow-tags.css
.tags {
  display: flex;
  flex-flow: row wrap;
  gap: 0.5rem;
}
Try It Yourself

How It Works

Tags flow left to right and wrap to new lines when they run out of room, without extra markup or grid columns.

♿ Accessibility

  • Wrapping preserves DOM order — screen readers follow source order across wrapped lines.
  • Avoid horizontal scroll on nowrap toolbars — ensure buttons remain reachable on small screens.
  • Use semantic lists for tags when tags represent categories or filters.
  • Test keyboard navigation on wrapped flex rows with many interactive items.
  • Do not use wrap-reverse for primary navigation without testing focus order.

🧠 How flex-flow Works

1

Direction sets the main axis

The first part of flex-flow chooses row or column flow.

flex-direction
2

Wrap controls line breaks

The second part decides whether items stay on one line or wrap to new lines.

flex-wrap
3

Items fill available space

Flex items are placed along the main axis until a wrap break creates a new line or column.

Layout
=

Flexible responsive flow

One shorthand controls direction and wrapping for cleaner CSS.

🖥 Browser Compatibility

The flex-flow property is well-supported across all modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. This ensures consistent behavior of flex layouts across different platforms.

Baseline · Universal support

flex-flow everywhere

All direction and wrap combinations work in every modern browser as part of standard Flexbox.

99% Universal support
Google Chrome 29+ · Desktop & Mobile
Full support
Mozilla Firefox 28+ · Desktop & Mobile
Full support
Apple Safari 9+ · macOS & iOS
Full support
Microsoft Edge 12+ · All versions
Full support
Opera 17+ · Modern versions
Full support
flex-flow property 99% supported

Bottom line: flex-flow is safe for all modern projects. Pair row wrap with gap for clean responsive layouts.

🎉 Conclusion

The flex-flow property is a convenient shorthand for controlling the flow of flex items within a container. By combining the flex-direction and flex-wrap properties, you can efficiently manage the layout and wrapping behavior of your flex items.

This property helps in creating flexible and responsive designs with minimal CSS code, making it an essential tool for modern web development.

💡 Best Practices

✅ Do

  • Use flex-flow: row wrap for responsive card and tag layouts
  • Combine with gap instead of margins on every item
  • Use the shorthand to keep CSS concise
  • Set a max-width on wrapped containers for readable line lengths
  • Learn the longhand properties when you need to override one value alone

❌ Don’t

  • Apply flex-flow on flex items instead of the container
  • Use nowrap on mobile when items overflow horizontally
  • Forget display: flex on the parent
  • Rely on column wrap without setting container height or width
  • Assume wrap alone creates equal column widths — use flex-basis or flex on items

Key Takeaways

Knowledge Unlocked

Five things to remember about flex-flow

Use these points when building wrapped Flexbox layouts.

5
Core concepts
02

row nowrap

Default value.

Default
📂 03

row wrap

Responsive grids.

Common
04

column wrap

Multi-column flow.

Advanced
📝 05

Less CSS

One line setup.

Tip

❓ Frequently Asked Questions

The flex-flow property is a shorthand for flex-direction and flex-wrap. It sets both the main axis direction and whether flex items wrap onto multiple lines in one declaration.
The initial value is row nowrap, meaning items flow horizontally in a single line without wrapping.
flex-direction only sets the main axis direction. flex-flow sets both direction and wrap behavior, equivalent to writing flex-direction and flex-wrap together.
Use row wrap for responsive card grids, tag lists, or toolbars where items should move to the next line when the container runs out of horizontal space.
Yes. If you specify only flex-direction, flex-wrap defaults to nowrap. If you specify only flex-wrap, flex-direction defaults to row.

Practice in the Live Editor

Open the HTML editor, try flex-flow: column wrap and row wrap, and watch items reflow when you resize the container.

HTML Editor →

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.

5 people found this page helpful