flex-flow

Term side of the Card.
Topic: Flexboxes
Unit title: flex-flow
Categories: Property
Explanation side of the Card

Explanation: The shorthand property that combines `flex-direction` and `flex-wrap` properties into a single declaration. It controls both the direction in which flex items are laid out and whether they should wrap onto multiple lines if there's not enough space in the flex container.

Browser compatibility:
  • The chrome browser supports this feature starting from version 29.
  • The edge browser supports this feature starting from version 12.
  • The firefox browser supports this feature starting from version 28.
  • The safari browser supports this feature starting from version 9.
Availability: 

Example

css
.tags {
  display: flex;
  flex-flow: row wrap;
}

'row wrap' sets flex-direction and flex-wrap in one declaration, so the tags line up in a row and wrap onto new lines.

Common mistakes

  • Putting justify-content values into flex-flow.

Key points

  • The shorthand lists direction and wrap, like flex-flow: row wrap, not alignment values.
  • Wrapped rows set gap for spacing instead of margins on each item.

Interview questions

What is the default value of flex-flow?

It is row nowrap: items sit in one horizontal line and do not wrap.

Can I set only wrap with flex-flow?

Yes. flex-flow: wrap sets wrapping and resets direction to 'row'.

Analytics cookiesWe'd like to use analytics cookies to see which pages are useful. They're set only if you accept. Privacy Policy