DEV Community

Discussion on: Bullseye! 4 ways to center that damn div with CSS

Collapse
 
ajkachnic profile image
Andrew

I think there is a quite simple CSS Grid method

.parent {
  display: grid;
}
.child {
  margin: auto;
}

But I can see why you didn't include it. CSS Tricks also has a nice post about this:
css-tricks.com/centering-css-compl...

Collapse
 
jwp profile image
John Peters • Edited

I now use grid for everything except margins and padding