[ 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.)
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

File: 1792852195761.jpg (200.91 KB, 1024x1024, img_1792852187415_h2znekqz.jpg)ImgOps Exif Google Yandex

ba861 No.2276[Reply]

i've been using scale-down for those annoying gaps when an image is too small to fill its parent. it's way better than contain cover because it doesn't stretch the pixels if the container happens to be tiny.

img {width: 100%;height: 100%;object-fit: scale-down;}


does anyone else avoid using contain for this?

ba861 No.2287

>>2276
scale-down is fine until you hit high-dpi screens where that pixelated mess looks terrible. try setting a max-width on the img tag instead when you actually want to keep things sharp, but don't use it if you need the layout to stay fluid

ba861 No.2290

>>2276
>>2287 I had this exact issue on a landing page last week for a client with some low-res assets. Using scale-down made everything look so blurry once the viewport widened. I ended up just sticking to contain and adding some background color to hide the edges instead.

ba861 No.2294

>>2290
>Using scale-down made everything look so blurry once the viewport widened.
blurry is a death sentence for crawl budget and user trust. if you're serving low-res assets, ime you should just be using srcset to serve different sizes anyway. what's your current strategy for handling those small source files?



File: 1793054053062.jpg (135.83 KB, 1024x1024, img_1793054044142_t8qgdzao.jpg)ImgOps Exif Google Yandex

ff7e3 No.2293[Reply]

Been struggling with this all morning on a dashboard project. I tried to set a minmax for columns but it's totally ignoring the container width once the content gets too chunky.
> It'll just expand the whole page width and create that annoying side scroll.
I ended up having to use overflow: hidden on the parent wrapper just to keep things from breaking the layout.
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));overflow: hidden;


File: 1792803931721.jpg (192.11 KB, 1024x1024, img_1792803922286_958jk5i5.jpg)ImgOps Exif Google Yandex

bb77b No.2273[Reply]

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



File: 1792602456564.jpg (113.03 KB, 1024x1024, img_1792602448104_nl4dbu7s.jpg)ImgOps Exif Google Yandex

9fd95 No.2262[Reply]

I've been trying to stick to rems for everything lately but it's making my component margins feel totally disconnected from the local text size. If I change a heading to be larger, the spacing around it stays tiny because rem ignores the parent's font scaling. Using em for margins in cards works way better since the whitespace scales with the content itself. It's much more predictable when you're nesting elements.

.card {font-size: 1.25rem;margin-bottom: 1em;}

>rem is always better for consistency

That logic falls apart once you start building complex nested components that need to scale together. Stick to em for anything related to padding or margin inside a component's internal layout.

9fd95 No.2278

>>2262
>Stick to em for anything related to padding or margin inside a component's internal layout.

Using em everywhere makes it way too easy to accidentally break your whole layout just by changing one font size in a deep child element. **It's a nightmare to debug

9fd95 No.2285

File: 1792975866069.jpg (332.15 KB, 1024x1024, img_1792975851300_u62zucsy.jpg)ImgOps Exif Google Yandex

>>2278
>It's a nightmare to debug

I ran into this last week when I tried to use em for a button icon. I bumped up the font size on a wrapper and suddenly the icon was huge and pushing everything out of alignment. It works if you keep your component scope super tight, but it definitely gets messy once you have multiple layers of nesting. I ended up just reverting back to rems anyway

9fd95 No.2289

>>2285
>I ended up just reverting back to rems anyway

same thing happened with a sidebar widget. i used em for the padding and then bumped the icon size, and now the entire container is broken because the padding expanded way too far. it's fine if you use variables to lock things down but otherwise you're just asking for trouble.



File: 1793011420003.jpg (208.75 KB, 1024x1024, img_1793011410933_pv7mrihx.jpg)ImgOps Exif Google Yandex

e4c90 No.2288[Reply]

stop writing fifty different media queries just to scale your font size. use clamp with a viewport width unit so the text scales itself between a min and max value automatically. tbh it saves so much bloat in my stylesheets


File: 1792522824141.jpg (279.48 KB, 1024x1024, img_1792522815996_wdvhrcs6.jpg)ImgOps Exif Google Yandex

e8f32 No.2260[Reply]

everyone is obsessed with adding photocopy textures and scribbles to everything now. they're calling it this big punk revival with cut-out typography and distorted photos. honestly sounds like a nightmare for maintaining any kind of design system or accessibility standards. how am i supposed to scale anything if the whole point is to make it look broken?

article: https://www.screamingfrog.co.uk/blog/design-trends-shaping-2026/

e8f32 No.2263

File: 1792624789986.jpg (262.74 KB, 1024x1024, img_1792624775015_gvq95w73.jpg)ImgOps Exif Google Yandex

>>2260
>how am i supposed to scale anything if the whole point is to make it look broken?

it's just a nightmare for z-index management too. every time someone adds another layer of "distorted" svg or a weirdly positioned ::after pseudo-element, my entire stack order goes to hell. trying to keep things readable with all those overlapping textures is basically impossible without heavy use of opacity and some insane clip-path values. i'm already struggling enough with just keeping the z-index at 1 and 2. are you using a specific library for those scribble assets or just raw pngs? sounds like a headache to keep responsive.

e8f32 No.2286

>>2263
The z-index thing is such a headache when you're working with complex grids. I've spent way too much time debugging why a decorative grain overlay is suddenly covering up my navigation links. Are you using any specific naming convention for your layers to stop the stacking order from breaking?



File: 1792480010198.jpg (168.61 KB, 1024x1024, img_1792480001644_4anwi8sr.jpg)ImgOps Exif Google Yandex

1fafc No.2259[Reply]

I'm struggling with a flex item that keeps expanding past its container because of a single long URL in the text. I tried setting overflow: hidden but it just cuts off the text instead of wrapping it. I even added word-break: break-all but the layout still breaks when the string is really long. It seems like min-width: 0 isn't doing enough here since the content is forcing the width out.
>the layout keeps breaking on mobile
.card {display: flex;flex-direction: column;}

I need it to respect the flex basis without pushing the parent wide.

1fafc No.2264

>>2259
>It seems like min-width: 0 isn't doing enough here when the content is forcing the width out.

min-width: 0 should actually be enough if you apply it to the flex item itself, not just the parent card. If you only put it on the container, the child still thinks its intrinsic size is the full length of that URL. I've had this happen with nested flexboxes before. Try adding it directly to the element holding the text.


.card-content {  min-width: 0;  overflow-wrap: anywhere;}


Using overflow-wrap: anywhere is usually better than break-all because it doesn't mess up your regular words. It just forces a break when there's no other choice.

1fafc No.2274

>>2264
applying min-width: 0 to the child won't fix a long url if you don't also change how it wraps. even with that property, the browser still tries to keep that string on one line by default. you need overflow-wrap: anywhere or at least overflow-wrap: break-word on the actual text element. otherwise the intrinsic size of the text content still pushes against the flex basis. i've seen plenty of devs forget the wrapping part and wonder why min-width: 0 does nothing for them. just use overflow-wrap: anywhere and it should behave.

1fafc No.2283

>>2274
overflow-wrap: anywhere is overkill for this. usually just setting overflow-wrap: break-word works fine on its own without causing weird gaps in the lines. tbh i've seen it cause some messy justification issues in older safari versions too.



File: 1792931697402.jpg (195.21 KB, 1024x1024, img_1792931689790_d4i0k8t4.jpg)ImgOps Exif Google Yandex

2ec01 No.2282[Reply]

been trying to center a simple nav but some idiot set min-width: 100% on the child elements. now it's just overflowing everything and ignoring the justify-content: center property entirely.
>it'll just wrap naturally if you don't overconstrain it
tbh it's basically impossible to debug when people treat flexbox like a magic box that fixes their bad sizing logic


File: 1792437130425.jpg (201.12 KB, 1024x1024, img_1792437122314_u91h4twf.jpg)ImgOps Exif Google Yandex

8a876 No.2255[Reply]

been seeing way too many people ditching aspect-ratio in favor of that old padding-top hack. it's honestly such a messy workaround when you have actual modern support to rely on. i was looking at this legacy codebase today and it's just full of:
.card {height: 0;padding-bottom: 56.25%;}

it makes the css so hard to read when you're trying to figure out the actual height of an element. i don't get why people are still clinging to this stuff for everything. if you aren't targeting prehistoric browsers, there's no reason to deal with that math. anyone still using the padding trick for anything other than extreme edge cases?

8a876 No.2275

>>2255
>if you aren't targeting prehistoric browsers, there's no reason to deal with that math

still gotta use it for some client dashboards on safari 13 or 14. can't just ignore the spec support gap for a living. i usually just wrap the whole thing in a utility class so the mess stays out of my main component files. keeps the
padding-bottom
logic away from the actual content styles. tbh it's less about hating math and more about not breaking the layout for users on old ipad minis.

8a876 No.2281

File: 1792925993303.jpg (283.79 KB, 1024x1024, img_1792925943684_31ojbojn.jpg)ImgOps Exif Google Yandex

>>2275
The utility class idea is smart for keeping things clean. I've had to do something similar because our legacy marketing site still has some weird dependencies on older mobile browsers. It's a pain when you have to use relative percentages just to keep the layout from collapsing.



File: 1792888840439.jpg (216.74 KB, 1024x1024, img_1792888831105_9dji2a7o.jpg)ImgOps Exif Google Yandex

6aeb2 No.2279[Reply]

been staring at this one bug all morning because i keep using width on elements that shouldn't have it. if you're doing any work with writing modes or vertical layouts, fixed widths are a nightmare. i finally switched to using the inline size property instead of just setting a standard width. it's much cleaner when things rotate.
>width: 300px;

that old way is such a headache once you move away from horizontal text. if you swap to inline size, the browser handles the dimension based on the flow direction automatically. it works great for sidebars that might flip orientation on tablets or specific print styles. i've been testing it with 'writing-mode: vertical-rl' and it doesn't break the container bounds like before.

.sidebar {inline-size: 250px;block-size: auto;}


it basically keeps your dimensions tied to the text flow. i still forget it exists sometimes. anyone else still relying on width for everything?


Delete Post [ ]
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
| Catalog
[ Home / About / Contact / WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]