The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › What is the correct/standard way of centering a container?
Here with the new layout systems like Grid and Flexboxes.
What is the (modern) standard way of centering a container that is either flexbox or a grid.
Should we use grid to center a grid container? Or there is more elegant ways to do this?
The same way you center any block level element
Doesn’t get any simpler than that. Anything else is overkill IMO.
…or unless there is something you haven’t mentioned.
Depends if it’s vertical or horizontal.
Css Tricks has an article on this.