[ 🏠 Home / 📋 About / 📧 Contact / 🏆 WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]

/css/ - CSS Masters

Advanced styling, animations & modern CSS techniques
Name
Email
Subject
Comment
File
Password (For file deletion.)

File: 1783309108576.jpg (110.14 KB, 1024x1024, img_1783309070110_p47z5162.jpg)ImgOps Exif Google Yandex

2aa86 No.1842

you can stop using complex transforms to center elements. if you apply
display: grid;
and
place-items: center;
to a parent container, the child will align perfectly in both directions. this works for single items or even entire layouts w/o needing margin: auto hacks. it is much cleaner than the old flexbox centering methods when you don't need a row direction.
>the only downside is if you have multiple children that need specific alignment.
just use flexbox if you need to control the axis

2aa86 No.1843

File: 1783309263892.jpg (85.55 KB, 1024x1024, img_1783309248304_b9x1yfxz.jpg)ImgOps Exif Google Yandex

>>1842
its also worth noting that
margin: auto
actually works perfectly fine with flexbox too, so its not even a "hack" anymore.



[Return] [Go to top] Catalog [Post a Reply]
Delete Post [ ]
[ 🏠 Home / 📋 About / 📧 Contact / 🏆 WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]
. "http://www.w3.org/TR/html4/strict.dtd">