Wondering why centering a div is a big problem for most developers?thats because css is hard.
but wuth this article,u leaner how to center div with very few steps
Html code
<div class="container"> <div class="child"></div> </div>
Css code
.container{ display: flex; justify-content: center; align-items: center; } .child { width: 50px; height: 50px; background-color: red; }
there u go..now you can center a div properly.