liveBook · Manning

Place-content

As explained in CSS in Depth, Second Edition

The CSS place-content shorthand property sets the align-content and justify-content properties together.

The CSS place-content shorthand sets align-content and justify-content together. Its two-value form controls alignment on both axes, making grid and flex layouts easier to tune. section 5.6 section 4.4.1

Center tracks and start them horizontally

For a grid, place-content: center start is equivalent to align-content: center; justify-content: start. The first value places grid tracks along the block axis, while the second positions them along the inline axis. section 5.6

Choose place-content when the container has extra space to distribute:

  • Use it with grid alignment values such as center, stretch, space-between, space-around, and space-evenly. section 5.6
  • In a wrapping flex container, use it to control spacing between rows along the cross axis while also setting justify-content. section 4.4.1
  • Remember that Flexbox justify-content has no effect when main-axis auto margins or non-zero flex-grow consume the available space first. section 4.4.1
Figure 5.22 Alignment properties for a grid
figure

A grid alignment figure helps compare how content positions and distributes within the container. section 5.6

How CSS in Depth, Second Edition covers it

How deep it goes
Defines the shorthand and gives one grid equivalence, while deferring detailed value examples to an external grid resource.
Examples
Demonstrates place-content: center start as the equivalent of separate align-content and justify-content declarations.
What it assumes
Assumes familiarity with CSS Grid or Flexbox containers and the align-content and justify-content properties.
What you can do after
Apply the shorthand to position grid tracks or wrapped flex rows and distribute remaining container space.
How it connects
Connects align-content and justify-content across CSS Grid and Flexbox, including flex wrapping and main-axis space calculation.

Also explained in

Compare how 2 books explain place-content →

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.