How to center a div in HTML and CSS.

A short brief:

This is the easiest and quickest way so far to center a div ( as far as I know 😆 ). I know it's kind of funny to write about this, but many people search about this topic (including me sometimes lol)


We are going to use Flexbox through the below CSS properties:

display: flex;
justify-content: center;
align-items: center;

Final result