Skip to content

Home

Grid centering

Horizontally and vertically centers a child element within a parent element using grid.

<div class="grid-centering">
  <div class="child">Centered content.</div>
</div>
.grid-centering {
  display: grid;
  justify-content: center;
  align-items: center;
  height: 100px;
}

More like this

Start typing a keyphrase to see matching snippets.