Re:SmolCSS – Minimal snippets for modern CSS layouts and com...
by SahAssar on Thursday November 11, 2021 @11:22AM
(#29189702)
Centering with position absolute does not work well if the content can be wider/higher than the container (like responsive layouts or if the content is unknown).
Using grid/flexbox fixes that and other corner-cases.
Also, for centering, I definitely prefer using position: absolute and transform: translate(-50%, -50%)
Using grid/flexbox fixes that and other corner-cases.