DEV Community

Rami Dev
Rami Dev

Posted on

How to easily center anything in CSS ?

You can easily center anything, with this 3 lines of CSS code:

Alt Text

Top comments (2)

Collapse
 
vanaf1979 profile image
Stephan Nijman

Or with two lines :p

.center {
display: grid;
place-items: center;
}

Collapse
 
ramialsayed profile image
Rami Dev

Yeah Grid team 😉