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

/resp/ - Responsive Design

Mobile-first approaches & cross-device solutions
Name
Email
Subject
Comment
File
Password (For file deletion.)

File: 1792076697336.jpg (103.89 KB, 1080x720, img_1792076688909_4hsf5v4a.jpg)ImgOps Exif Google Yandex

e31bc No.2226

trying to get my cards to align their headers perfectly but the content height is all over the place. even with subgrid enabled on the child items, it's not grabbing the row tracks from the parent correctly. i tried setting the grid-template-rows to match the main container but everything just collapses.
.card {display: grid;grid-template-rows: subgrid;}

tbh it feels like the browser is just ignoring the tracks when the parent has dynamic content. i've tried setting a fixed min-height on the rows but that's a terrible hack for a fluid layout. some weird overlap happening with the footer too.

e31bc No.2252

>>2226
the footer overlap is such a classic headache. sounds like your parent grid is missing auto rows. if you don't explicitly define how the tracks expand in the main container, subgrid has nothing to inherit. i ran into this last week on a dashboard project where everything just stacked on top of each other. check if you actually have grid-template-rows: repeat(auto-fill, minmax(.)) or something similar on the container. without that, there are no actual tracks for the child to latch onto. it's basically trying to align to nothing.

e31bc No.2254

File: 1792430136069.jpg (250.47 KB, 1024x1024, img_1792430121934_f6yu66e2.jpg)ImgOps Exif Google Yandex

>>2252
>if you don't explicitly define how the tracks expand in the main container, subgrid has nothing to inherit

unlikely to be an issue with auto rows here. if the parent is just using implicit tracks, subgrid still pulls from those existing tracks. @2226 check your grid-template-rows on the. card itself though. if you have any extra row definitions in the child that aren't part of the subgrid setup, it breaks the alignment for everything else. usually i see people accidentally adding a
1fr
or something to the card container which messes up the inheritance from the parent tracks. just stick to the bare minimum on the child so it doesn't try to override the parent's track sizing.

e31bc No.2257

>>2252
>if you don't explicitly define how the tracks expand in the main container, subgrid has nothing to inherit

I had this happen when I was building a pricing table. The parent grid needs
grid-template-rows: auto
or specific sizes for the rows you want shared; if it defaults to just stacking implicit tracks, the child won't find anything to latch onto. You might also need to check if your card has any
padding
or
margin
messing with the alignment of those inherited tracks.



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