DEV Community

Discussion on: Centering in modern CSS

Collapse
 
russellbishop profile image
Russell Bishop

If you have just one child element to center, you can set flex on the parent and margin auto on the child.

Collapse
 
mr_eis profile image
Marius Eisenbraun

Yeah, that's a very nice solution, too!

For myself, I like to use the container to take care of its inner layout. That's why I wrote about this approach.