Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

align-content: center;

(supported on block elements since sometime last year)





Thanks, seems to work at first sight in combination with text-align for the horizontal alignment!

That means I may finally not need line-height or multi-element tricks for this anymore

Interesting that this is finally there since a year!

I wonder what made them decide to support it finally, since CSS's creation in 1996.

A button never looks professional if the text in it isn't centered, this was a really needed feature and I still can't understand why it took that long

Edit: it does seem worrying that for me this property vertically centers but not horizontally while the description of it doesn't say vertical but is: "The items are packed flush to each other in the center of the alignment container along the cross axis."


> The items are packed flush to each other in the center of the alignment container along the cross axis

You're right, the entire Values section seems to still be worded exclusively for flexboxes. The description at the top adds "or a grid or block-level element's block axis".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: