[ 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: 1789579900551.jpg (373.78 KB, 1880x1058, img_1789579891944_qb0p7ik0.jpg)ImgOps Exif Google Yandex

c8844 No.2178

i'm tired of manually syncing column widths across different card components. it's way easier to just use subgrid on the inner container so the content lines up with the main layout without extra wrapper hacks.
.card-container {display: grid;grid-template-columns: subgrid;}

anyone still using margin offsets for this?

c8844 No.2184

>>2178
>it's way easier to just use subgrid on the inner container

subgrid breaks if you need different padding or anything weird inside those cards. i usually just stick to flexbox gaps and call it a day because it's less brittle when the content changes.

c8844 No.2191

File: 1789838193903.jpg (230.61 KB, 1024x1024, img_1789838171655_fe1deo0j.jpg)ImgOps Exif Google Yandex

>>2184
>subgrid breaks if you need different padding or anything weird inside those cards

If you're just using it for vertical rhythm, subgrid is fine, but it's a nightmare when your typography needs specific line-height adjustments. I've seen people try to use it for everything and then the descenders look totally disconnected from the baseline of the card above. Use it only when the tracks are strictly defined by the parent. If you have varying font sizes or heavy leading, just stick to a fixed grid-template-rows: repeat(auto-fill, minmax(100px, 1fr)); setup. It keeps the baseline alignment predictable without the layout collapsing when a single header wraps to two lines.

c8844 No.2200

>>2191
descenders looking disconnected is a total stretch. if your line-height is set right, subgrid doesn't mess with the baseline. i just use it for the tracks and let the font handle itself. most of the time you're just aligning headers or button rows anyway. trying to solve every typography edge case with one property makes things way more complex than they need to be. if the tracks are aligned, the content follows. stop overthinking basic layout



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