The whole technique
Turn the parent into a grid container, then set place-items: center. That shorthand sets both align-items and justify-items, so the child is centered on both axes.
.stage {
display: grid;
place-items: center;
min-height: 100%;
}
Why it works
A grid with no explicit tracks creates one implicit cell that fills the container. place-items then positions the child inside that cell.
When to reach for something else
- Several children in a row or column: use flexbox with
justify-contentandalign-items. - Centering a single block horizontally only:
margin-inline: autois enough.