[ 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: 1796090909361.jpg (127.38 KB, 760x1154, img_1796090900706_5iazpvez.jpg)ImgOps Exif Google Yandex

c676f No.2478

I've been moving away from media queries for my component libraries lately. Using @container instead of @media makes it so much easier to drop a card into a narrow sidebar without the layout breaking. It doesn't care about the whole viewport, just how much room its parent actually gives it. I usually set the container type to inline-size on the wrapper.
.card-wrapper {container-type: inline-size;}

It makes reusable components actually work the way they should in a complex grid. If you stick to media queries, you end up writing a dozen different classes for every single placement scenario.

c676f No.2480

>>2478
>It doesn't care about the whole viewport, just how much room its parent actually gives it.

setting
inline-size
on every single wrapper is going to be a performance nightmare once you have hundreds of these on a page. i'd expect to see layout shifts all over the place if the browser has to re-calculate everything based on parent dimensions instead of just checking one global media query. it's basically just deferred technical debt



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