liveBook · Manning

Wrap

As explained in Web Design Playground

In layout, the behavior in which content moves onto a new line when there is insufficient horizontal space.

Wrap lets content move onto a new line when one horizontal row no longer has enough room. In Flexbox, it is a container choice: keep items on one line, or let them form additional lines. section 12.2

Think of wrapping as giving a row of items permission to make another row:

  • nowrap keeps the items together on one line. section 12.2
  • wrap lets items continue on new lines when needed. section 12.2
  • wrap-reverse provides the reverse wrapping direction. section 12.2

A flexible photo gallery

A photo gallery can place thumbnails in a Flexbox container, center them horizontally, and allow them to wrap into additional rows as space changes. section 15.28

container {
    display: flex;
    flex-wrap: nowrap|wrap|wrap-reverse;
}

Use the flex-wrap declaration to choose whether Flexbox items stay on one line, wrap, or wrap in reverse. section 12.2

How Web Design Playground covers it

How deep it goes
Defines three flex-wrap values and connects wrapping to container layout, but does not detail line-sizing behavior.
Examples
Uses a centered photo gallery whose thumbnail links wrap within a Flexbox container.
What it assumes
Assumes familiarity with a Flexbox container and its child flex items while introducing container axes alongside wrapping.
What you can do after
Apply it via the CSS flex-wrap property to keep items together, wrap them, or reverse their wrapping direction.
How it connects
Connects wrapping with Flexbox containers, flex items, main and cross axes, alignment, and photo-gallery layout.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Web Design Playground. The section links point to the parts of the book it draws on.