X

Headline

This is an important message requiring you to make a choice if you're based in the EU.

CSS flex-flow Property

The flex-flow property is a shorthand property for the flex-wrap and flex-direction properties.

The flex-flow property is one of the CSS3 properties.

The flex-flow property is a part of the Flexible Box Layout module.

If there are no flexible items, the flex-flow property won't have any effect.

The flex-flow property is used with -Webkit- extension for Safari, Google Chrome, and Opera.

Initial Value row nowrap
Applies to Flex containers
Inherited No.
Animatable No.
Version CSS3
DOM Syntax object.style.flexFlow = "column nowrap";

Syntax

flex-flow: flex-direction | flex-wrap | initial | inherit;

When we set the flex-flow: row wrap, it means that the first value specifies the flex-direcion, and the second one specifies the flex-wrap property.

-webkit-flex-flow: row wrap ;
flex-flow: row wrap;

The following code is the same as the code above.

-webkit-flex-direction: row;
 flex-direction: row;
-webkit-flex-wrap: wrap;
 flex-wrap: wrap;

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style> 
      .example {
      width: 200px;
      height: 200px;
      border: 1px solid #c3c3c3;
      display: -webkit-flex; 
      display: flex;
      -webkit-flex-flow:  row wrap;
      flex-flow: row wrap ;
      }
      .example div {
      width: 50px;
      height: 50px;
      }
    </style>
  </head>
  <body>
    <h2>Flex-flow property example</h2>
    <div class="example">
      <div style="background-color: #8ebf42;">A</div>
      <div style="background-color: #1c87c9;">B</div>
      <div style="background-color: #ccc;">C</div>
      <div style="background-color: #666;">D</div>
      <div style="background-color: #4c4a4a;">E</div>
      <div style="background-color: #c6c4c4;">F</div>
    </div>
  </body>
</html>

Here, "wrap-reverse" and "column" values are used.

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style> 
      .example {
      width: 200px;
      height: 200px;
      border: 1px solid #c3c3c3;
      display: -webkit-flex; 
      color:#ffffff;
      text-align:right;
      display: flex;
      -webkit-flex-flow:  column wrap-reverse;
      flex-flow: column wrap-reverse;
      }
      .example div {
      width: 50px;
      height: 50px;
      }
    </style>
  </head>
  <body>
    <h2>Flex-flow property example</h2>
    <div class="example">
      <div style="background-color: #8ebf42;">A</div>
      <div style="background-color: #1c87c9;">B</div>
      <div style="background-color: #ccc;">C</div>
      <div style="background-color: #666;">D</div>
      <div style="background-color: #4c4a4a;">E</div>
      <div style="background-color: #c6c4c4;">F</div>
    </div>
  </body>
</html>

Values

Value Description
flex-direction Defines the flexible items' direction.
Possible values are:
row
row-reverse
column
column-reverse
initial
inherit
flex-wrap Defines if the flexible items should wrap or not.
Possible values are:
nowrap
wrap
wrap-reverse
initial
inherit
initial Makes the property use its default value.
inherit Inherits the property from its parents element.

Browser support

29.0+
21-28 -webkit-
12.0+ 28.0+ 9.0+
6.1-8.0 -webkit-
12.1+


Do you find this helpful?

Related articles