DEV Community

loading...

Discussion on: Centering in modern CSS

Collapse
darival profile image
Darival

There is also another way to do this with grid.

.grid--container {
display: grid;
place-content:center;
}

Collapse
mr_eis profile image
Marius Eisenbraun Author

Yes, that should work to!

For the once, who doesn't know:
place-content is the shorthand for align-content and justify-content.

align-content has a different behavior than align-items. I guess, I never used align-content, so i didn't want to mention a technique i haven't tested in real life.

Did you use align-content? Why / in what context?