In the olden days of CSS, centering an element both horizontally and vertically within its parent was notoriously difficult. Style wizards stayed up until late at night coming up with ways to achieve this feat. They succeeded, but their techniques were obscure and convoluted. Then flexbox came along and changed everything by making it almost ridiculously easy to plop something smack dab in the middle of the page:
Yep, that’s all there is to it. Here’s an example:
Browser support: % (Source: caniuse.com)
Specification: