DEV Community

Discussion on: The Ultimate Guide to Center Align - CSS

Collapse
 
mvoloskov profile image
Miloslav 🏳️‍🌈 🦋 Voloskov • Edited

It's better to ditch fixed width and height solutions as antipatterns, because content changes, and such changes should be made without the help of a frontend developer.

The only robust solutions are flex and grid.

Transition-based solution can also be made robust by setting max-width, max-height and overflow, because we put the element out of the document flow by using absolute positioning, but why reinvent the wheel?

Nice article though!

Collapse
 
venkyakshaya profile image
Akshaya Venkatesh

"in order of adherence to best practices" That's why the fixed width and height solutions are at the very bottom.
I didnt quite understand "Transition-based solution can also be made robust by setting max-width, max-height and overflow, because we put the element out of the document flow by using absolute positioning, but why reinvent the wheel?" Could you clarify?
Do you mean transform?

Collapse
 
mvoloskov profile image
Miloslav 🏳️‍🌈 🦋 Voloskov

Yes, it's transform. Sorry, it was 1am when I wrote the original comment)