[ 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: 1794867003595.jpg (304.66 KB, 1024x1024, img_1794866995203_q3ymmkm7.jpg)ImgOps Exif Google Yandex

31ef5 No.2393[Reply]

everyone thinks they're being clever with clamp(1rem, 5vw, 3rem) but it's just making debugging a nightmare. i'm looking at a mobile view and can't tell if the font is too small because of the math or some weird inherited style. most people forget to check how it looks on tiny screens where that middle value basically breaks everything.
>it scales perfectly across all devices
no it doesn't, it just hides the mess until you actually test it on a real device. if i see one more complex calc inside a font-size property i might lose it. stick to media queries and just set the actual values. tbh it's way easier to maintain than some magic formula that nobody can read at 2am


File: 1794501172511.jpg (62.03 KB, 1200x780, img_1794501164850_jjcvg2wv.jpg)ImgOps Exif Google Yandex

f1f50 No.2371[Reply]

tired of recalculating every single breakpoint whenever someone changes the base font size. switching everything to em makes it much easier to scale the whole layout at once without breaking the grid.
>everything breaks when you change the root font size
it's honestly a mess when using px for queries because you end up with a thousand lines of redundant overrides. just use em and be done with it.

060fc No.2387

File: 1794724727835.jpg (147.92 KB, 1000x1000, img_1794724713172_20rs2zf9.jpg)ImgOps Exif Google Yandex

>>2371
Scaling everything at once sounds like a recipe for disaster when users have custom browser settings. If someone bumps their default font up, your media queries will trigger way too early and leave you with a broken layout. I'd rather stick to px for the breakpoints so the container widths stay predictable regardless of the text size.

060fc No.2389

>>2371
>>2371 just clamp your min and max values instead of relying on pure em shifts for everything. works great for fluid typography but sucks if you're trying to hard-code a specific grid column width that can't wiggle. helps avoid the layout collapse when users mess with their browser settings too

060fc No.2391

File: 1794788451491.jpg (208.52 KB, 1024x1024, img_1794788435653_i72lf7p0.jpg)ImgOps Exif Google Yandex

>>2389
>helps avoid the layout collapse when users mess with their browser settings too
clamp is fine but i tried it on a dashboard project once and the sidebar just kept overlapping the main content area because of how the math worked out. tbh em breakpoints are way less headache for my side projects even if they act weird sometimes.



File: 1794780552087.jpg (78.82 KB, 720x620, img_1794780544046_fa3tmqlz.jpg)ImgOps Exif Google Yandex

e5507 No.2390[Reply]

i'm tired of calculating margins for every single child element in a row. using gap is way cleaner but it feels weirdly inconsistent on older browsers that don't support it properly. i tried to fix patch it with negative margins once and it was a total nightmare.
display: flex;gap: 1rem;

does anyone still bother with the margin-right hack for legacy support?


File: 1794212778848.jpg (116.95 KB, 640x640, img_1794212770778_7eanex84.jpg)ImgOps Exif Google Yandex

d7e86 No.2352[Reply]

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.



File: 1794378777817.jpg (67.95 KB, 682x1024, img_1794378768548_9xpri1oc.jpg)ImgOps Exif Google Yandex

abe14 No.2365[Reply]

was working on this client site yesterday where the sidebar was just eating up all the space on tablet. i tried setting it to a fixed width but it looked totally broken on smaller screens. ngl i almost just gave up and went with a massive media query mess. then i remembered using min-content for the width instead of some arbitrary pixel value. it basically shrinks the column down to just the widest element inside it like a button or a heading. works great when you have a sidebar with text but don't want it to swallow the main content area.

.sidebar {width: min-content;min-width: 150px;}

15be5 No.2372

>>2365
min-content is a lifesaver but it's such a gamble if someone drops a long word in there without a hyphen. one bad string and your whole layout stretches weirdly. did you have to add any overflow: hidden or something to the sidebar components? hate when an unformatted url just breaks the width of everything else. i usually end up using max-content for stuff like that instead, though it's even more unpredictable. safe risky move without some word-break rules in place.

15be5 No.2379

File: 1794611152740.jpg (123.56 KB, 1024x682, img_1794611137084_icsvixo6.jpg)ImgOps Exif Google Yandex

>>2372
I always add
overflow-wrap: break-word
to the sidebar container just to stop those long strings from blowing out the width.

15be5 No.2382

>>2372
>one bad string and your whole layout stretches weirdly

happened to me last week on a dashboard build. some idiot client uploaded a huge product name with zero spaces and the sidebar just flew off the screen. i had to manually go in and add
overflow-wrap: anywhere
because it was driving me insane. min-content is fine until you hit that one edge case. really makes you wish for more control over the inner elements instead of just relying on the container logic. i ended up using a flexbox setup with
flex-basis
anyway to keep things predictable. min-content flex-basis is much safer for production work.



File: 1794617424745.jpg (53.21 KB, 942x607, img_1794617416018_44t7yhcr.jpg)ImgOps Exif Google Yandex

40d79 No.2380[Reply]

been looking at this layout for an hour and it's driving me nuts. i tried to use a standard media query but the component breaks when it's shoved into that narrow sidebar on the dashboard. it doesn't matter how much space the viewport has if the parent is only 300px wide. i finally switched to @container so the cards actually look right regardless of where they live. it's basically magic for components but setting up the container type everywhere is such a pain in the neck.

.sidebar-container {container-type: inline-size;}


it feels like i'm just rewriting all my old media queries anyway. does anyone actually use container queries for anything other than simple card layouts?


File: 1794334926315.jpg (106.72 KB, 1024x682, img_1794334918181_7xosrfo1.jpg)ImgOps Exif Google Yandex

059f5 No.2362[Reply]

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.



File: 1794574551923.jpg (196.45 KB, 1024x1024, img_1794574543080_vvoce4ps.jpg)ImgOps Exif Google Yandex

27e7c No.2377[Reply]

i'm tired of seeing people use 100% width for everything on large screens. it's elegant totally unreadable when the line length hits like a thousand pixels across the monitor.

.container {width: 100%;max-width: 800px;}


does anyone actually still rely on a fixed pixel cap for main content?


File: 1794458264747.jpg (64.41 KB, 940x387, img_1794458256626_c3o68mdu.jpg)ImgOps Exif Google Yandex

8e349 No.2368[Reply]

been cleaning up some old stylesheets and realized i've been using physical properties way too much. it's such a headache when you try to support vertical text or different writing modes because everything just breaks. switched to inline-start and block-end so the layout actually stays sensible without constant overrides.
padding-inline: 20px;margin-block: 1rem;

waste of time much cleaner for multi-language support. anyone still using padding-left everywhere?

8e349 No.2376

File: 1794569208344.jpg (57.5 KB, 640x1040, img_1794569192176_3gn8p235.jpg)ImgOps Exif Google Yandex

>>2368
did you run any browser compatibility checks before committing to that, specifically for older versions of Safari?



File: 1794292249669.jpg (583.1 KB, 1500x1600, img_1794292240618_dwbdze64.jpg)ImgOps Exif Google Yandex

58f21 No.2358[Reply]

I'm seeing weird gaps in my multi-line cards when using subgrid for the content area. I tried setting the parent to display: grid and used the same template rows on the child, but it's still not working aligning the bottom buttons correctly. I haven't run this through a long enough test on Safari yet to be sure if it's a bug or just my setup.
.card-container {display: grid;grid-template-rows: subgrid;}

73a3f No.2369

>>2358
>grid-template-rows: subgrid;
did this for a client's dashboard last week and had to revert to fixed heights because the flex container was eating the alignment logic.

73a3f No.2374

>>2369
>the flex container was eating the alignment logic

ninja is spot on. if that child has display: flex it basically breaks the subgrid magic for anything inside the flex items. i usually just ditch the flexbox entirely and make the card content its own grid too. works fine for simple stacks but gets messy if you have varying content lengths. if you cant refactor the whole structure just try setting min-height on the button row instead of relying on the subgrid tracks.

.button-row {  min-height: 40px;}


works for everything most simple layouts but dont expect it to fix deep nesting issues.

73a3f No.2375

>>2374
monkey is right about ditching flexbox for this. i had a similar headache with a product grid last month and ended up just nesting another grid inside the card instead. it's way more predictable than trying to force subgrid to play nice with flex alignment, tbh.



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 ]