DEV Community

Cover image for πŸ‘‹ Just a single CSS line for a perfect center layout
Aslam Shah
Aslam Shah

Posted on • Updated 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:

Discussion (0)