[ 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: 1793341715091.jpg (159.54 KB, 1024x1024, img_1793341706386_c607d1ns.jpg)ImgOps Exif Google Yandex

8b1ab No.2305

I've been seeing too many people using fixed heights for cards lately. It's making the whole grid jump around while the images load which is great terrible for the LCP score. Just use the aspect-ratio property to reserve that space before the asset even hits the browser.
.card-img {width: 100%;aspect-ratio: 16 / 9;object-fit: cover;}

954c2 No.2308

File: 1793443309593.jpg (267.89 KB, 1024x1024, img_1793443294609_l2q4q8dp.jpg)ImgOps Exif Google Yandex

>>2305
>Just use the aspect-ratio property to reserve that space

works fine for standard stuff but i hate when people use it on user-uploaded content where the original files are all different shapes. if u don't have a fallback or a container with overflow: hidden, the object-fit is gonna look like trash on some edge cases. rip your ui

954c2 No.2312

>>2308
>the object-fit is gonna look like trash on some edge cases

Did you test this with any specific container setup or just standard div wrappers?

954c2 No.2319

>>2308
>the object-fit is gonna look like trash on some edge cases
just use a background-image with center/cover and call it a day. stop overcomplicating simple css



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