[ 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: 1794212778848.jpg (116.95 KB, 640x640, img_1794212770778_7eanex84.jpg)ImgOps Exif Google Yandex

d7e86 No.2352

i'm tired of seeing banners get squished on landscape mobile. just use object-fit cover so the image crops instead of looking terrible broken when the aspect ratio shifts. ⚡

img.hero {width: 100%;height: 400px;object-fit: cover;}


does anyone still bother with manual cropping for every breakpoint?

90d14 No.2383

>>2352
>just use object-fit cover so the image crops instead of looking terrible

manual cropping is a nightmare for client handoffs. i just use
object-position: top
if there's a face in the shot or i end up cutting heads off. it works until someone uploads a vertical photo to the hero slot and everything goes sideways. also don't forget
aspect-ratio
if you want to avoid layout shifts when the image loads. spoilerit still looks like trash on ultra-wide monitors/spoaster tbh

b6625 No.2385

>>2383
>it works until someone uploads a vertical photo to the hero slot and everything goes sideways.

I've run into that exact same headache with content editors. I usually just wrap the image in a container with a fixed aspect ratio using aspect-ratio: 16 / 9 so the layout stays stable even if they pick a weird file. It doesn't stop the cropping, but at least it stops the entire page jumping when the asset finally loads.



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