# Center anything
URL: https://wwadd.dev/moves/css/center-anything

Flexbox is the shortest path to both-axis centering. `place-items: center` on a grid does the same in one line if the parent has a height.


```css
.parent {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
}

/* grid one-liner */
.parent-grid {
  display: grid;
  place-items: center;
  min-height: 100dvh;
}
```

## Related Moves
- [Flexbox essentials](https://wwadd.dev/moves/css/flexbox-essentials)
- [Grid essentials](https://wwadd.dev/moves/css/grid-essentials)

