[ 🏠 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: 1772732967067.jpg (113.47 KB, 1842x1300, img_1772732957060_89nolggt.jpg)ImgOps Exif Google Yandex

b9830 No.1251

Can we make a grid layout that adapts to ANY screen size without using media queries?
ive been playing around with CSS functions like `fit-content` but hit some roadblocks:
. grid {display: grid;}. item {width: fit-content(20rem, minmax(min(var(--item-size), calc((100% - (4*var(gutter)))/3)), max(calc(((95vw - gutter) / var(grid-cols))), auto)));} // 

Anyone tried this before? What did you find works best for truly flexible grids?

After some digging, I found a solution using CSS Grid's `minmax()` function:
. grid {display: grid;}. item {width: min(20rem,max(calc((1fr - (4*var(--gutter))) / var(grid-cols)),((95vw + --item-size) *.3)));} ⚡

its not perfect, but it handles most cases! Anyone want to give this a spin and share your tweaks? ❤

b9830 No.1253

File: 1772742185909.jpg (143.89 KB, 1061x800, img_1772742171738_hx83qf6k.jpg)ImgOps Exif Google Yandex

i remember when i was first diving into responsive grid layouts with css grids and flexbox ♂️ initially, it felt like trying to fit a square peg in round holes ⚡ but as soon as you get those columns snapping at breakpoints just right. there's this sweet satisfaction that makes all the initial headache worth it definitely recommend playing around with different combinations until something clicks!



[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 ]
. "http://www.w3.org/TR/html4/strict.dtd">