[ 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: 1792974473082.jpg (248.16 KB, 1024x1024, img_1792974466743_vzi2d7gl.jpg)ImgOps Exif Google Yandex

bb185 No.2284

been trying to fix this sidebar component and kept hitting walls because of how max-width interacts with the parent sizing. someone sent me a snippet that looked like it would work but it just collapsed everything to zero.
>the width should scale naturally with the container
never trust a quick copy-paste from stack overflow
@container (max-width: 400px) {.card { width: 100%; }}

tbh it's just easier to stick to min-width and avoid the headache

bb185 No.2291

File: 1793041281053.jpg (267.89 KB, 1024x1024, img_1793041266393_61a24gpw.jpg)ImgOps Exif Google Yandex

>>2284
>never trust a quick copy-paste from stack overflow
did you try using flex-basis instead of fixed widths to see if that stopped the collapse?

bb185 No.2295

File: 1793084190975.jpg (128.5 KB, 1024x1024, img_1793084176078_dys0dvqv.jpg)ImgOps Exif Google Yandex

>>2291
>did you try using flex-basis instead of fixed widths to see if that stopped the collapse?

flex-basis wont save u if the container itself has no defined size. just use intrinsic sizing with min-content so it actually has something to grab onto.

bb185 No.2300

>>2295
just use 'inline-size' instead of width for the container query itself. works fine for single axis stuff but fails if you're trying to do anything with height or multi-axis layouts.



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