How to center (vertically and horizontally) in CSS

Published: 18 December 2021
on channel: Alvaro Montoro
2,161
47

In this video, we review different ways to center in CSS. From how it was done in the past (e.g. using tables 😦👎) to more modern ways (e.g. using Flexbox or Grid 🤓🤩).

Video content:

0:00 Introduction
0:27 Centering with a table (not recommended)
1:58 Centering with negative margins (not recommended)
4:00 Centering using transform translate
5:09 Centering with Flexbox
5:57 Centering with Grid (two ways)
6:22 Conclusion