DEV Community

Cover image for 👋 Just a single CSS line for a perfect center layout
Aslam Shah
Aslam Shah

Posted on • Edited on

👋 Just a single CSS line for a perfect center layout

place-items is a shorthand property for align-items and justify-items and can be used to perfectly center elements.

  display: grid;
  place-items: center;
Enter fullscreen mode Exit fullscreen mode

Browser Support
MDN Docs

Live in Action:

Top comments (0)