DEV Community

loading...

How to easily center anything in CSS ?

ramialsayed profile image Rami Dev ・1 min read

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

Alt Text

Discussion (2)

pic
Editor guide
Collapse
vanaf1979 profile image
Stephan Nijman

Or with two lines :p

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

Collapse
ramialsayed profile image
Rami Dev Author

Yeah Grid team 😉