DEV Community

Discussion on: Absolute center position with CSS

Collapse
 
adityamitra profile image
Aditya Mitra

I guess margin:auto; also works if the parent container is relatively positioned.

I use display:flex;
align-item:center;
justify-content:center;

Collapse
 
hi_iam_chris profile image
Kristijan Pajtasev

It could and most of browsers do support flex, but absolute position is something that def should work everywhere. Which is why it is more common solution