display grid align items code example

Example 1: css grid align

.grid {
  display: grid;
  align-items: center; /* left and right */
  justify-content: center; /* up and down */
}

Example 2: align items center in grid

article {
  display: inline-grid;
  grid-template-rows: 100px 100px 100px;
  grid-template-columns: 100px 100px 100px;
  grid-gap: 3px;
}

section {
  display: flex;
  justify-content: center;
  align-items: center;
  border: 2px solid black;
  font-size: 3em;
}

Example 3: align grid items with end

display: grid;
align-items: end;

Tags:

Css Example