Rachel Andrew, blowing my mind a bit:
The
align-content in block layoutalign-content
property from the Box Alignment spec does the job, however browsers require that you make the parent element either a flex or a grid layout. While the property was specified to work in block layout, no browser had implemented it, until now.
So now we can vertically center an element without having to reach for grid or flexbox.
Ollie Williams covered the news as well in Easy vertical alignment without flexbox, and also notes:
align-content
now also works for elements with adisplay
oftable-cell
orlist-item
.
I would like to point out a small gotcha we may face if we try to use this with images and similar elements: https://css-tip.com/align-content-center/