align-content: The Simplest Way to Center Content with CSS

Finally, we can center things in block layouts without flexbox gymnastics

Block layouts have been part of CSS since the beginning, but they’ve always lacked proper alignment controls. Now, with align-content support in block layouts, we can distribute content vertically with the same flexibility we’ve enjoyed in flex and grid.

The old approaches required either flexbox or grid as a workaround. With flex, we needed multiple properties to achieve vertical centering. Grid made it a bit simpler with align-content, but still required changing the layout mode.

With the new align-content support in block layouts, we can achieve the same result while maintaining block layout semantics. No need to switch layout modes - just add align-content to your block container.

The browser will distribute the available space automatically, positioning your content in the center of the container. This works with any block container that has a defined block size.

display: flex

Centers with flex

justify-content: center
display: grid

Centers with grid

align-content: center
display: block

Centers with block

align-content: center

Browser Support and Fallbacks

This feature requires browsers that support the latest CSS Box Alignment specification. For older browsers, you can use either the flex or grid approach as a fallback.

The safest approach is to use @supports to provide a fallback for browsers that don’t support align-content in block layouts. This way, you can ensure a consistent experience across all browsers.


Trevor I. Lasn

Trevor I. Lasn

Building whiteheap.com and 0xinsider.com.



Related Articles

Check out these related articles that might be useful for you. They cover similar topics and provide additional insights.

CSS
8 min read

Create animated transitions between different states of your app without complex animation libraries.

Nov 11, 2025
Read article
CSS
3 min read

Use scrollbar-width to thin or hide scrollbars and scrollbar-gutter to prevent layout shift. Browser support, examples, and gotchas.

Dec 19, 2024
Read article
CSS
4 min read

Style connected UI with the :interest-source and :interest-target pseudo-classes. Interactive examples of tooltips, forms and navigation without JavaScript.

Nov 12, 2025
Read article
CSS
3 min read

Use CSS @supports to check whether a browser supports a feature such as grid, and give other browsers a fallback. How it works, with multiple conditions.

Dec 6, 2024
Read article
CSS
3 min read

content-visibility: auto lets the browser skip layout and paint for offscreen elements until they are needed. How to use it with contain-intrinsic-size.

Dec 5, 2024
Read article
CSS
4 min read

How to implement the Open-Dyslexic font to enhance readability for users with dyslexia

Oct 12, 2024
Read article
CSS
3 min read

A look at how browsers can highlight text fragments using CSS ::target-text, making text sharing and navigation more user-friendly

Dec 17, 2024
Read article
CSS
3 min read

The ::details-content pseudo-element lets you style the expandable content of details elements separately from the summary, no divs needed.

Nov 11, 2025
Read article
CSS
4 min read

CSS nesting is finally supported in all major browsers. Write cleaner, organized stylesheets without Sass or Less

Dec 6, 2024
Read article

This article was originally published on https://www.trevorlasn.com/blog/css-align-content-in-block-layouts. It was written by a human and polished using grammar tools for clarity.