The align-content property controls how multiple lines in a flex container, or multiple tracks in a grid container, are distributed along the cross axis when extra space is available. It is a layout property that helps you position whole rows or tracks, not individual items inside one row.
01
Cross-Axis Lines
Move whole lines or tracks.
02
Syntax
One property, many keywords.
03
Flexbox
Works with wrapped flex lines.
04
CSS Grid
Also distributes grid tracks.
05
Spacing Values
center, between, evenly, and more.
06
Common Pitfalls
Know when it has no effect.
Fundamentals
Definition and Usage
The align-content CSS property sets how a flex container’s lines are aligned within the flex container when there is extra space on the cross axis. In a grid container, it does the same job for grid tracks.
Think of it this way: if a flex container wraps items into multiple rows, align-content decides where those rows sit inside the container’s height. It does not align one item inside a row — that is the job of align-items.
💡
Beginner Tip
Use align-content only when your container has extra cross-axis space and more than one line or track. Give the container a fixed height in flexbox, or use a grid with fewer tracks than the available space.
The grid tracks stay grouped in the center of the container instead of stretching to fill the full height.
🧠 How align-content Works
1
Items wrap into lines or tracks
In flexbox, wrapped items form multiple rows. In grid, explicit tracks define rows or columns.
Layout
2
Extra cross-axis space appears
When the container is taller or wider than the combined lines or tracks, free space remains on the cross axis.
Condition
3
align-content distributes the lines
Values like center, space-between, and stretch position the whole group of lines or tracks.
Alignment
=
📦
Balanced multi-row layouts
Whole rows or tracks move together, while align-items still handles item alignment inside each row.
Compatibility
Universal Browser Support
align-content is widely supported in all modern browsers for both flexbox and CSS Grid layouts.
✓ Baseline · Flexbox & Grid
Reliable layout support across browsers
From current Chrome and Safari builds to Firefox and Edge, align-content is a stable tool for modern responsive layouts.
98%Modern browser 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
OperaModern versions
Full support
Legacy notes
Very old browsers may support flexbox align-content but not grid alignment.
💻
Internet ExplorerIE 10–11 flex only · No grid align-content
Partial
align-content property98% supported
Bottom line: Use align-content confidently in modern flexbox and grid layouts.
Wrap Up
Conclusion
The align-content property is an essential tool for flexbox and grid layouts. It gives you control over how multiple lines or tracks are distributed along the cross axis when extra space is available.
For beginners, remember the key idea: align-content moves whole rows or tracks, while align-items aligns items inside one row. Experiment with values like center, space-between, and space-evenly to see how they change your layout.
Give flex containers a cross-axis size when you want visible alignment
Use flex-wrap: wrap when you expect multiple lines
Pair align-content with justify-content for full layout control
Test spacing values like space-between and space-evenly
Use align-items for item alignment inside a single row
❌ Don’t
Expect align-content to work on a single-line flex row
Confuse it with align-items or justify-content
Forget to set a container height in flexbox demos
Assume every layout needs align-content
Skip testing on small screens where wrapping changes line count
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about align-content
Use these points when building flex and grid layouts.
5
Core concepts
📦01
Line Alignment
Moves whole rows or tracks.
Purpose
📐02
Cross Axis
Works when extra space exists.
Axis
🛠03
Default
stretch fills the space.
Values
🔄04
Flex + Grid
Useful in both layout systems.
Scope
💡05
Not align-items
Different job, different result.
Compare
❓ Frequently Asked Questions
The align-content property controls how multiple lines in a flex container, or multiple tracks in a grid container, are distributed along the cross axis when there is extra space available.
align-items aligns individual items inside a single line or track. align-content aligns the lines or tracks themselves as a group inside the container.
It only works when the container has extra space on the cross axis and more than one line or track. If everything fits in one line, align-content does nothing.
The initial value is stretch. Lines or tracks stretch to fill the available cross-axis space.
Yes. In grid layouts, align-content distributes grid tracks along the block axis when the grid container has extra space.