[ 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: 1792803931721.jpg (192.11 KB, 1024x1024, img_1792803922286_958jk5i5.jpg)ImgOps Exif Google Yandex

bb77b No.2273

still seeing devs use height: 100% or some weird calc instead of just setting aspect-ratio: 16 / 9. it's literally one line. i saw a ticket today where someone was trying to fix a jumping layout with a massive media query block and a bunch of padding-top hacks. it's so much cleaner to just let the browser handle the proportions. looks like they were using some old legacy-css-library that doesn't even support modern properties properly. if you aren't using aspect-ratio for your card thumbnails, you're basically just making extra work for yourself. i hate seeing these massive files full of margin-bottom: 56.25% nonsense. it makes the devtools nightmare even worse when you're trying to debug a simple flexbox issue.
img {width: 100%;aspect-ratio: 4 / 3;object-fit: cover;}

tbh it's just lazy to keep doing the padding trick in 2024.

bb77b No.2277

>>2273
that padding-top hack is pure torture to debug. someone's definitely still stuck in 2015 if they're writing 56.25% margins.

bb77b No.2280

>>2277
spent three hours yesterday digging through a legacy codebase for a client and found a bunch of those same padding hacks scattered everywhere. it was driving me insane trying to figure out why the container heights kept shifting on resize. just found a massive block of margin-top calcs that made the whole grid look broken on mobile. definitely feels like 2015 in there.

bb77b No.2292

>>2280
>just found a massive block of margin-top calcs that made the whole grid look broken on mobile.

That sounds like a nightmare, but i'm pretty sure those margin calcs aren't even for the layout itself. Usually it's just some weird leftover from an old responsive plugin or a botched attempt at centering things. If someone is actually using margin-top to force a height, they're probably not even trying to fix a grid issue. I'd expect them to be messing with the width or padding instead. It's hard to tell without seeing the actual CSS, but it feels like such an odd way to break a mobile view. Maybe just delete the whole block and start over



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