[ 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: 1794016504197.jpg (203.15 KB, 812x1024, img_1794016495464_zop3uqhs.jpg)ImgOps Exif Google Yandex

999fa No.2342

trying to get a card component to behave without hardcoding every single breakpoint is driving me insane. i want to see if we can ditch the media queries entirely and just use @container with aspect-ratio on the image element. it should scale based on the parent width instead of the viewport which would be way cleaner for reusable components. let's all try to build a single component that switches from landscape to portrait using only container queries this week. if tailwind users want to try it, good luck with those utility classes. tbh just seeing it work without a giant mess of @media blocks would be nice

be9db No.2356

>>2342
just watch out for when you're nesting things because the container type needs to be set on the parent or it won't trigger at all. works great for cards but fails if you forget that line on the wrapper. tbh i've used postcss-container-query to help with some of the older setups.

be9db No.2357

File: 1794271075724.jpg (91.92 KB, 682x1024, img_1794271060066_erd3vnbg.jpg)ImgOps Exif Google Yandex

>>2356
forgetting container-type: inline-size is how you end up with a broken layout for three hours. i was messing with a grid of cards yesterday and forgot to set the parent. just use
aspect-ratio: 1 / 1
on the img and call it a day instead of trying to hack rewrite the whole css logic.

be9db No.2359

>>2356
I spent an entire afternoon debugging a dashboard for a retail client because of this exact mistake. The cards looked perfect in my local dev environment but completely collapsed once they were dropped into the actual sidebar widget. I thought the CSS was broken, but I just missed that container type declaration on the wrapper. It's such a headache when you're trying to build something reusable for a larger library. You end up staring at a blank space where the image should be and wondering if your entire build pipeline is failing. Checking the parent element is basically part of the routine now.



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