The justify-content property distributes free space between and around content along the main axis of a flex container, and along the inline axis of a grid or multicol container.
In a row flex, that means left–right packing: center, space-between, and friends. There must be leftover free space, or every keyword looks the same. It does not apply to normal block boxes. To align items on the cross axis, use align-items. To pack wrapped lines, use align-content.
Standard-track.
Not deprecated and not experimental. Flex and grid values are widely available (Baseline since 2015). Keywords like safe / unsafe and some newer positions have thinner support.
Fixed tracks. Three 60px columns are narrower than the section, so free inline space exists.
Justify the tracks.justify-content moves the columns as a group—not the content inside each cell.
Even gaps.space-evenly makes the space before the first column, between columns, and after the last column the same size.
Cell alignment. To align content inside a cell, use justify-items instead.
Edge Cases & Pitfalls
If nothing moves, free space is usually already gone.
grow
flex-grow eats free space
If any item on the line has flex-grow greater than 0, that growth uses the free space first. Then justify-content has nothing left to distribute.
space
No free space, no visible change
If the container is only as wide as its items, every keyword looks the same. Give the container a larger main size, or shrink the items.
axis
Column flex flips the axis
With flex-direction: column, the main axis is vertical. justify-content then packs top to bottom and needs spare height.
vs
Not align-items or justify-items
align-items is cross-axis. justify-items aligns content inside grid cells. justify-content distributes free space around items or tracks.
stretch
stretch in flex is a no-op lookalike
In flexbox, main-axis stretch is controlled by flex / flex-grow, so justify-content: stretch behaves like start. Stretching tracks is a grid concern.
safe
safe / unsafe are optional
safe center falls back toward start if centering would clip overflow. Support is thinner than the basic keywords—prefer plain center unless you need overflow safety.
Compatibility
Browser Support
justify-content is a browser layout property for flex, grid, and multicol. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Widely available since 2015
justify-content
Flex: Chrome 29+, Firefox 28+, Safari 9+, Edge 12+. Grid: Chrome 57+, Firefox 52+, Safari 10.1+, Edge 16+. Internet Explorer 11 is flex-only (older values).
96%Flex and grid support
Google Chrome29+ flex · 57+ grid
Full support
Mozilla Firefox28+ flex · 52+ grid
Full support
Apple Safari9+ flex · 10.1+ grid
Full support
Microsoft Edge12+ flex · 16+ grid
Full support
Opera16+ flex · grid in Chromium 57+
Full support
Samsung Internet4+ flex · 6.2+ grid
Full support
Internet Explorer11 · Old flex only
Partial
justify-contentWidely supported
Bottom line: Safe for flex and grid in current browsers. Prefer start/end/center and the space-* keywords for widest reach. safe/unsafe and some logical keywords vary by browser.
Remember
Key Takeaways
Role: distribute free space along the flex main axis or grid inline axis.
Needs free space: fixed items (or tracks) inside a larger container; avoid flex-grow eating the gap.
Not align-items: that property is cross-axis; this one is main / inline.
Initial value:normal. It is not inherited.
One line:justify-content shares leftover main-axis (or grid inline) space—after sizes are set, and only if free space remains.
Frequently Asked Questions
It distributes free space between and around items along the main axis of a flex container, or along the inline axis of a grid (or multicol) container.
The initial value is normal. In a flex container that behaves like start (pack toward the main-start edge).
justify-content works along the main axis (or grid inline axis) and needs free space. align-items aligns items on the cross axis inside a line or area.
There must be leftover free space. If items grow with flex-grow, or the container is only as wide as its content, every keyword looks the same.
Yes. It justifies the grid tracks (columns on a horizontal grid) when the grid is narrower than its container. It does not align items inside cells—that is justify-items.
Flex support goes back to Chrome 29, Firefox 28, Safari 9, and Edge 12. Grid support starts at Chrome 57, Firefox 52, and Safari 10.1. It is a browser layout property, not a Node.js feature.