Justify-content
The CSS justify-content property distributes flex items or grid tracks along the relevant container axis when free space is available.
Web Design Playground, Second Edition
The CSS justify-content property controls how flex or grid items are distributed along their container's main axis.
- How it is used
- Arranges flex items along a container’s main axis, from simple centering to spacing items in page layouts.
- How deep it goes
- Defines six values, compares their visible effects, and works through centering; does not descend into layout internals.
- Examples
- Uses a centered heading, a photo-gallery header, and portfolio images spread with space-between.
- What you can do after
- Apply it via CSS to center flex items or distribute them across a container.
Read how Web Design Playground, Second Edition explains justify-content →
Tiny CSS Projects
The CSS justify-content property controls how free space is distributed along the main axis of a flex or grid layout.
- How it is used
- Positions flex children by distributing leftover space, from centering a profile card to separating credit-card details.
- How deep it goes
- Explains four values through layout rules and shows why unequal item widths can make a space-around row look off-center.
- Examples
- Shows a centered profile card and actions, spaced profile statistics, and details arranged across a virtual credit card.
- What you can do after
- Apply it via CSS Flexbox to center children or distribute them across a container, while checking gaps and unequal widths.
Web Design Playground
A CSS alignment property that distributes and aligns items along the main axis of a flex container or grid container.
- How it is used
- Arranges flex items along the container’s main axis, including centering page content or aligning a nested column at its start.
- How deep it goes
- Defines five values and explains their placement, default, and `space-around` gap behavior; does not develop layout internals.
- Examples
- Uses an interactive value playground, a window-centered heading, and nested flex containers in a portfolio layout.
- What you can do after
- Operate/configure it by choosing a CSS value that positions flex items along the main axis.
CSS in Depth, Second Edition
The CSS justify-content property distributes grid tracks or flex items along the container's inline or main axis when free space is available.
- How it is used
- Positions flex items or grid tracks along the relevant horizontal or main axis when free space remains.
- How deep it goes
- Explains core values, logical-direction behavior, spacing differences, and calculation order, while deferring exhaustive examples.
- Examples
- Demonstrates a centered stylized price using flex items and positions grid tracks within an oversized grid container.
- What you can do after
- Apply justify-content to center, edge-align, or distribute flex items and grid tracks according to available space.
Read how CSS in Depth, Second Edition explains justify-content →
Related concepts
- main axisuses · The main axis is the primary direction in which a flex container arranges and distributes its flex items.
- flexboxconfigures · Flexbox is a CSS one-dimensional layout model for arranging, sizing, aligning, and distributing items along a row or column.
- flex containerconfigures · A flex container is an element whose children are laid out as flex items according to the CSS Flexible Box Layout model.
- place-contentequivalent to · The CSS place-content shorthand property sets how content is aligned and distributed along a container’s axes.
- grid containerconfigures · A grid container is an element whose display mode establishes a CSS Grid formatting context for laying out its child elements as grid items.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



