Hacker News new | past | comments | ask | show | jobs | submit login

Bit of an old meme now, which mostly comes out of misunderstanding the difficulty of actually designing a layout system and the tradeoffs involved.

Anyway it's easy and has been for ages:

  display: table-cell; vertical-align: middle;



It sure doesn't help that there are multiple "easy" ways to do it. A sibling content mentions flexbox. There's another with CSS transforms.

CSS accumulates techniques, each one intended to compensate for defects with the other -- and they interact in obscure ways. Googling will always turn up recommendations for each. You end up with Perl-like "There Is More Than One Way To Do It" -- and you have to know all of them if you want to actually do anything.


Is `display: table` a css feature made for centering things? No?

Not a fan of tailwind, but whoever thinks that is simple misunderstood the meaning of the word, it's not about the number of characters you have to type.




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

Search: