DEV Community

Discussion on: My Favorite Ways of Centering With CSS

Collapse
 
link2twenty profile image
Andrew Bone • Edited

This is just another way to achieve the first method, just without the negative margins.

.absolute.parent {
  position: relative;
}

.absolute .child {
  position: absolute;
  top: calc(50% - 110px);
  left: calc(50% - 110px);
}
Collapse
 
steffenpedersen profile image
Steffen Pedersen

You are absolutely right 😊 But I'm so happy, that flexbox is well supported in these days. It is so much easier and looks much more clean.