display grid place-items center code example

Example 1: place item center in css using grid

.parent-element {
   display: grid;
   place-items: center;
}

Example 2: css grid center elements inside div

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: place-items css property

This property is a shorthand for the following CSS properties:
1-align-items
2-justify-items

Possible values => start|flex-start|self-start|end|flex-end|self-end|
right|left|center|space-around|space-between|space-evenly|baseline|stretch

Tags:

Misc Example