Modern Way to Center Elements with CSS

If you’ve worked with CSS for a longer period, you’ve probably seen and used about a dozen different ways to center block-level elements on the page. These methods used to vary between a combination of negative margins , CSS translations , Flexbox , and more. Heck, I’ve even used the infamous display: table back in the day. Fortunately, we today have a solution that requires only two lines of CSS,…