DEV Community

Aashutosh Soni
Aashutosh Soni

Posted on • Updated on

How to Center a Div?

There are two Most used ways of centering a Div-

  • First Method-
display: flex
justify-content: center
align-items: center
Enter fullscreen mode Exit fullscreen mode
  • Second Method-
display: grid
place-items: center
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Collapse
 
ashutosh7i profile image
Aashutosh Soni

Thank you @kristories for new info✨🚀