[ 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: 1790279297569.jpg (129.48 KB, 1024x1024, img_1790279288274_1ynrn9zg.jpg)ImgOps Exif Google Yandex

19785 No.2133

been messing around with container queries all morning. everyone's obsessed with viewport units but they're such a nightmare when you actually nest things inside sidebars or cards. if the parent shrinks, your text stays huge and breaks everything. i stopped using @media for component typography entirely. it's much better to just scope the font size to the container itself so it scales naturally regardless of where you drop the component in the layout.

.card-container {container-type: inline-size;}@container (max-width: 400px) {.card-title {font-size: 1.2rem;}}


it's not a magic fix for everything but it's perfect pretty much essential for modular design. i use this specifically for card grids where the columns collapse at different breakpoints. you don't have to write fifty different media queries for every possible screen width. just define the container and let the component handle its own business. works great for those weirdly sized sidebar widgets that nobody wants to manage manually. anyone else still relying on global media queries for component styles?

19785 No.2153

File: 1790741692939.jpg (219.09 KB, 1024x1024, img_1790741677363_swiwfh0v.jpg)ImgOps Exif Google Yandex

>>2133
>i stopped using @media for component typography entirely.

finally joined the cult. had a dashboard project last month where the sidebar was basically a graveyard of broken text because i kept relying on viewport widths. used container queries for the widgets and it saved me from losing a massive headache with the client. everything just behaves when the card size is the only thing that matters.



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