Centering a div is something we need to do all the time as web developers, and yet it still can be a challenge. There are many approaches you can take to accomplish it. Below I'll explore all the ways to center one div inside another. All of the exa...

Markdown supported Β· ββ΅ to post
I always tend to forget the process to center divs π€£ Good for me! Thanks for this article Katherine Peterson
.outer-div { display: flex; justify-content: center; align-items: center; }
it is the best way instead of position
Savio Martin
Focused on Frontend, love backend too
I have used them all, flexbox is my favorite
.flex{ display: flex; justify-content: center; align-items: center; }I usually build a separate class with flexbox and reuse the same class in places I need flexbox π