The align-content property packs or spreads the lines of a flex or grid container when there is spare space on the cross axis. In a row flex, that axis is vertical: it decides where the wrapped rows sit inside a tall box.
There must be more than one line, and leftover space, or every keyword looks the same. A flex container also needs flex-wrap: wrap. A single line does nothing. To move items inside one line, use align-items.
Standard-track.
Not deprecated and not experimental. Flex and grid values are widely supported. Block layout, multi-column layout, and last baseline are newer and still missing in some browsers.
Same two lines. One and Two stay on the first row. Three and Four wrap to the second.
Measure the spare height. The 180px box is taller than those two rows.
Pin the edges.space-between puts the first line on the top edge and the last line on the bottom edge.
The gap is the leftover. All spare height sits between the lines, not inside them. space-evenly would also leave a gap above the first line and below the last.
Example 3 — Grid Rows
Spread four grid rows with equal space, including the edges. No flex-wrap.
Switch to grid.display: grid makes one column of rows by default. Each child is its own row.
Leave spare block space.height: 180px is taller than the four rows.
Share that space evenly.space-evenly makes the gap above the first row, between rows, and below the last row the same size.
No wrap property. Grid tracks already exist, so flex-wrap is not part of this rule.
Edge Cases & Pitfalls
If the lines do not move, one of these is usually why.
nowrap
One flex line ignores it
The default is flex-wrap: nowrap. With a single line, align-content has no group of lines to pack. Set flex-wrap: wrap.
space
No spare cross space, no visible change
If the container is only as tall as its lines, every keyword looks the same. Give a row flex a height, or a column flex a width.
items
align-items is a different job
align-items moves items inside one line. align-content moves the lines. Setting both is normal; they do not replace each other.
stretch
stretch needs an auto cross size
A fixed height on the items blocks stretch. Leave the cross size as auto if you want the lines to grow and fill the container.
axis
A column flex flips the axis
With flex-direction: column, the cross axis is horizontal. align-content then packs columns left and right, and it needs spare width.
Compatibility
Browser Support
align-content is a browser layout property for flex, grid, and newer block layout. Node.js, Deno, and Bun do not apply it.
✓ Baseline · Flex since 2015
align-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.
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
align-contentWidely supported
Bottom line: Safe for flex and grid in current browsers. Block layout needs Chrome 123, Firefox 125, or Safari 17.4. Firefox does not apply it in multi-column layout. last baseline is not implemented in Chrome, and Safari recognizes that value but does not use it.
Remember
Key Takeaways
Role: pack or spread flex lines, or grid rows, when the container has spare cross-axis space.
Flex requirement:flex-wrap: wrap and a height (for a row). One line does nothing.
Not align-items: items move inside a line; content moves the lines.
Initial value:normal, which stretches in flex and grid. It is not inherited.
One line:align-content places the lines in the leftover space — after wrap, and after the container is bigger than those lines.
Frequently Asked Questions
It packs or spreads flex lines, or grid rows, along the cross axis when the container is taller than those lines. It does not move items inside a single line.
A flex container with the default flex-wrap: nowrap has only one line, so there is nothing to distribute. You also need leftover space on the cross axis, usually a height larger than the lines.
align-items positions items inside one line. align-content positions the lines themselves inside the container. Use align-items when nothing wraps. Use align-content when you have multiple lines and spare space.
Yes. In a grid it distributes the rows (the block axis) when the grid is taller than those rows. Grid does not need flex-wrap.
No. Set it on the flex or grid container, not on the items. The initial value is normal, which acts like stretch in flex and grid.
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. Internet Explorer 11 only has the old flex behavior. It is a browser layout property, not a Node.js feature.