liveBook · Manning

Flex-wrap

As explained in CSS in Depth, Second Edition

The CSS flex-wrap property specifies whether flex items remain on one line or wrap onto additional lines or columns.

The flex-wrap property controls whether flex items stay on one line or wrap onto additional rows or columns when they would overflow their flex container. section 4.4.1

Choose the behavior that matches the container’s layout constraints:

  • nowrap is the initial value and keeps items on one line. section 4.4.1
  • wrap moves overflowing items onto a new row instead of shrinking them according to flex-shrink. section 4.4.1
  • wrap-reverse enables wrapping in the reverse direction. section 4.4.1
  • With column or column-reverse, wrapping creates additional columns only when the container’s height is constrained. section 4.4.1

Combine direction and wrapping

Use flex-flow: column wrap when items should flow from top to bottom and continue in a new column when the constrained height is exceeded. section 4.4.1

How CSS in Depth, Second Edition covers it

How deep it goes
Defines three values and explains overflow, flex-shrink interaction, and height constraints for column wrapping.
Examples
Uses nowrap, wrap, wrap-reverse, and flex-flow: column wrap as concrete declarations.
What it assumes
Assumes familiarity with flex containers and flex-direction while defining wrapping behavior directly.
What you can do after
Apply wrapping rules to flex containers and predict when items form new rows or columns.
How it connects
Connects flex-wrap with flex-direction, flex-flow, flex-shrink, and flex containers.

Also explained in

Compare how 3 books explain flex-wrap →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of CSS in Depth, Second Edition. The section links point to the parts of the book it draws on.