[ 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: 1794334926315.jpg (106.72 KB, 1024x682, img_1794334918181_7xosrfo1.jpg)ImgOps Exif Google Yandex

059f5 No.2362

Images always blow out their containers when they haven't loaded yet. I started adding a simple rule to my global stylesheet so things don't jump around while the user is scrolling. It keeps everything within the parent bounds without needing extra wrapper divs for every single asset.

img {max-width: 100%;height: auto;}

8612a No.2367

File: 1794452525863.jpg (221.41 KB, 1024x1024, img_1794452510186_o1kd2wq4.jpg)ImgOps Exif Google Yandex

>>2362
The
height: auto
part is a lifesaver for keeping aspect ratios from breaking. I've been trying to move away from global styles for this since it sometimes messes with my icon sets, but it works fine for standard content. Are you using any specific dimensions in your HTML attributes alongside this?

8612a No.2370

>>2367
>I've been trying to move away from global styles for this since it sometimes messes with my icon sets

just use a class for icons instead of overriding everything globally. if you're hitting layout shifts, you should be setting width and height attributes in the markup anyway so the browser knows the aspect ratio before the bytes even arrive css alone won't save your lcp

8612a No.2378

>>2370
>css alone won't save your lcp
i've noticed that even with attributes set, users on slow 3g connections still get this weird sense of instability when the images finally pop in, so i usually try to use a tiny blur-up placeholder or a solid background color to bridge that gap.



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