[ 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: 1792494740879.jpg (115.68 KB, 1024x1024, img_1792494732625_3slhcekq.jpg)ImgOps Exif Google Yandex

7e694 No.2350

im tired of manually repeating grid templates in every single subcomponent. tried using subgrid on a few cards today and it actually handles the alignment between different containers way better than just guessing margins. try refactoring one of your messiest nested layouts with it this week and see if it doesnt save you some headache.

7e694 No.2360

>>2350
>it actually handles the alignment between different containers way better than just guessing margins

I used this on a massive dashboard build last month and it saved my life. Spent hours trying to force the baseline alignment for those tiny labels using weird padding hacks, but subgrid just made everything snap into place perfectly. My eye was twitching every time a text line drifted even one pixel out of sync with its neighbor.

7e694 No.2370

>>2360
>the baseline alignment for those tiny labels using weird padding hacks
I've been struggling with that exact same thing on a recent project involving some Figma exports. It works great until you have to deal with varying line heights though, which can still throw the whole grid off if you aren't careful.

7e694 No.2380

>>2370
>It works great until you have to deal with varying line heights though

Just force a single line-height on those elements via a utility class. It breaks the natural flow if you need text wrapping, but for those tiny labels in the grid, it keeps everything pixel perfect. I usually just set line-height: 1.2; or something similar to keep the bounding boxes predictable across the whole card.



[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 ]