CSS Portal

CSS flex-flow Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The flex-flow property is the shorthand used on a flex container to express both the container’s main-axis orientation and its wrapping behavior in a single declaration. By combining those two concerns, it provides a compact way to control whether child items are laid out along a horizontal or vertical axis and whether they are allowed to break onto multiple lines when space is constrained. Using this shorthand makes it easier to reason about the high-level flow of items without repeating separate declarations.

As a container-level setting, flex-flow only has effect when the element is a flex container — i.e., when its display mode establishes a flex formatting context. See display for more about creating flex containers. The choice of axis set through flex-flow determines which dimension is considered the “main” axis and which becomes the “cross” axis; that in turn changes how size, alignment, and wrapping behaviors are interpreted for the item collection. Allowing wrapping (the other part of the shorthand) changes whether items stay on one line or form multiple flex lines that can be laid out and aligned independently.

Although flex-flow directly controls only axis and wrap, its practical effect is shaped by many other flexbox properties. For example, alignment along the main axis is handled by justify-content, while alignment along the cross axis for individual items is governed by align-items and the alignment of multiple flex lines is controlled by align-content. Individual item ordering and distribution are still managed by per-item properties such as order and the various flex-family properties. In practice, think of flex-flow as setting the fundamental orientation and line behavior that all those other properties then refine.

Definition

Initial value
See individual properties
Applies to
Flex containers
Inherited
No
Computed value
See individual properties
Animatable
No
JavaScript syntax
object.style.flexFlow

Interactive Demo

Item 1
Item 2
Item 3
Item 4
Item 5
Item 6

Syntax

flex-flow: flex-direction || flex-wrap

Values

Example

<div class="wrap">
<h3>Flex-flow: row wrap</h3>
<div class="flex-container">
<div class="item">Item 1</div>
<div class="item">Item 2</div>
<div class="item">Item 3</div>
<div class="item">Item 4</div>
<div class="item">Item 5</div>
<div class="item">Item 6</div>
<div class="item">Item 7</div>
</div>
</div>
.wrap {
  max-width: 720px;
  margin: 24px auto;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  color: #333;
}

.flex-container {
  display: flex;
  flex-flow: row wrap;
  gap: 12px;
  padding: 12px;
  background: #f7f7f8;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
}

.item {
  flex: 0 1 170px;
  background: #ffffff;
  padding: 16px;
  border: 1px solid #ddd;
  border-radius: 6px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

/* Change the shorthand to column nowrap to see different behavior */
/* .flex-container { flex-flow: column nowrap; } */

Browser Support

The following information will show you the current browser support for the CSS flex-flow property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!