Align Content Property

Last updated: 2026-09-13

align-content Align Content Property

The align-content property sets how multiple lines of flex items are aligned and spaced on the cross axis. It only takes effect when wrapping (flex-wrap: wrap) produces more than one line. It works like justify-content but acts on the cross axis and distributes the space between the lines. On a single line the property does nothing; use align-items instead.

Category
Initial Valuenormal
InheritedNo
Applies To
Animation Type
CSS VersionCSS3
StatusStandard

📝 Syntax

align-content: normal | stretch | start | end | flex-start | flex-end | center | space-between | space-around | space-evenly | baseline;

⚙️ Values

ValueTypeDescription
normal | stretch | flex-start | flex-end | center | space-between | space-aroundKeywordMulti-line cross axis alignment

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
align-content v29 v12 v28 v9 v17
Supported in all major browsers
Warning: align-content only works in a multi-line flex layout. If the items do not wrap (single line), the property has no effect; in that case use align-items to control the cross-axis alignment.
Tip: align-content and align-items can be combined: align-content distributes the lines among themselves, while align-items aligns the items inside each line on the cross axis.

❓ FAQ

QWhat is the difference between align-content and align-items?
Aalign-items controls how the items align on the cross axis within a single line. align-content controls how the lines, as a group, are distributed on the cross axis. On a single line align-content does nothing; with multiple lines, align-items manages the items inside each line while align-content distributes the space between the lines. Both can be set at the same time because they work at different levels.
QWhy does align-content have no visible effect?
APossible reasons: the items do not wrap (single-line layout), the container has no definite height, or flex-wrap is still nowrap. align-content only works when flex-wrap: wrap produces multiple lines and the container has leftover space on the cross axis. Check flex-wrap and the container height to find the cause; a single line means there is nothing to distribute. A quick way to decide which property to use: one line means set align-items, while several wrapped lines that need spacing apart call for align-content.
QHow do I center multiple wrapped flex lines as a whole vertically?
AHandle it in two layers: set align-content: center on the container so the group of lines is centered on the cross axis (vertical). If the items within a line have different heights, also add align-items: center so the items in each line center vertically. This only works when the container has a definite height and flex-wrap: wrap produces more than one line; otherwise align-content has no effect.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏