CSS align-content Property
Description
The align-content CSS property controls how multiple lines of content are spaced and positioned along the cross axis of a flex or grid container. Unlike properties that affect individual items, align-content works on the distribution of space between rows or columns as a group. It only has a visible effect when there is extra space in the container and when content wraps into more than one line (for example, when flex-wrap: wrap is used or when a grid has multiple rows). If all items fit on a single line, align-content will have no visual impact.
In Flexbox layouts, align-content determines how rows of flex items are spaced vertically (in a row-based layout) or horizontally (in a column-based layout). It helps control how the entire group of wrapped items aligns within the container, rather than how each item aligns individually. This makes it especially useful for responsive designs where items wrap dynamically depending on screen size. Designers often use it to balance white space, center blocks of content, or distribute rows evenly for a cleaner visual layout.
In CSS Grid, align-content controls how the grid tracks (rows) are positioned inside the container when the grid does not fill all available vertical space. It influences the spacing between rows as well as how the entire grid aligns within its container. This makes it a powerful tool for shaping overall layout structure without adjusting individual grid items. When combined with other alignment properties like justify-content and align-items, align-content helps create polished, well-balanced layouts that adapt smoothly across different screen sizes and content lengths.
Definition
- Initial value
- stretch
- Applies to
- Multi-line flex containers
- Inherited
- No
- Computed value
- specified keyword
- Animatable
- yes
- JavaScript syntax
- object.style.alignContent
Interactive Demo
Syntax
align-content: start | end | flex-start | flex-end | center | space-between | space-around | space-evenly | stretch
Values
- startAligns the flexbox lines or grid items to the start of the cross axis.
- endAligns the flexbox lines or grid items to the end of the cross axis.
- flex-startLines inside the container are located at the beginning of the transverse axis of the flex container, or the initial edge of the grid of the grid container. For layout grid elements (grid elements) the abbreviated start value is allowed, for flex elements it is necessary to use the full flex-start value.
- flex-endLines inside the container are located at the end of the transverse axis of the flex container, or along the edge of the grid of the grid container. For layout grid elements (grid elements), the abbreviated end value is allowed; for flex elements, the full flex-end value must be used.
- centerLines inside the container are located in its center.
- space-betweenThe lines inside the container are evenly distributed, with the first line being positioned at the beginning of the transverse axis, and the last line being positioned from the end of the transverse axis.
- space-aroundLines inside the container are evenly distributed, while the space between two adjacent lines is the same, and the empty space before the first line and after the last line is half of the space between adjacent lines.
- space-evenlyPlaces an even space between each line, including the top and bottom edges of the container.
- stretchThe lines inside the container stretch evenly, filling the free space (resizes the grid elements, or flex elements so that the elements fill the entire height of the container). This is the default value.
Example
Browser Support
The following information will show you the current browser support for the CSS align-content property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
