DEV Community

Discussion on: CSS - Center both vertically and horizontally

Collapse
 
drozerah profile image
Drozerah

Yep !

body{

 place-items: center;

}

is the equivalent shorthand notation for :

body{

 justify-items: center;
 align-items: center;

}

And we also have place-self when it comes with child self position :

scss notation


body{

 height: 100vh;
 display: grid;

 myChild{

  place-self: center;

 }

}

for

scss notation


body{

 height: 100vh;
 display: grid;

 myChild{

  justify-self: center;
  align-self: center;

 }

}