Saturday, July 27, 2024

The align-content property for block layouts is now part of Baseline  |  Blog  |  web.dev

Web DevelopmentThe align-content property for block layouts is now part of Baseline  |  Blog  |  web.dev


You can now use the align-content property from CSS Box Alignment
on block and table layouts. This will allow block direction alignment without
needing to create a flex or grid layout.

The once impossible task of centering an item vertically was made easier by flexbox and grid,
along with the align-content property. However, it did involve creating a
flex or grid layout for no other reason than to do this alignment.
The property was specified for block layout, and in the past few months all
three major engines have shipped the feature.

With align-content available for block layout, you can achieve
vertical alignment without needing to create a flex or grid layout for the property to
work. No additional properties are needed as the item remains a block item, the
only change is to the alignment.

The align-content
property centers the heading vertically within a block container.

Check out our other content

Check out other tags:

Most Popular Articles