[ 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: 1794016504197.jpg (203.15 KB, 812x1024, img_1794016495464_zop3uqhs.jpg)ImgOps Exif Google Yandex

999fa No.2342[Reply]

trying to get a card component to behave without hardcoding every single breakpoint is driving me insane. i want to see if we can ditch the media queries entirely and just use @container with aspect-ratio on the image element. it should scale based on the parent width instead of the viewport which would be way cleaner for reusable components. let's all try to build a single component that switches from landscape to portrait using only container queries this week. if tailwind users want to try it, good luck with those utility classes. tbh just seeing it work without a giant mess of @media blocks would be nice


File: 1793937046109.jpg (119.53 KB, 640x852, img_1793937037434_18pk7k35.jpg)ImgOps Exif Google Yandex

97c5e No.2338[Reply]

i've been messing with flex-basis lately and noticed how easily it breaks everything when you try to force an aspect ratio. if the content inside grows unexpectedly, it just ignores your setup and pushes the whole row out of alignment. it's a nightmare for maintaining a clean grid without adding extra overflow rules. anyone else dealing with this on their mobile layouts?

97c5e No.2341

>>2338
>it just ignores your setup and pushes the whole row out of alignment
happened to me last week on a dashboard build for a client. i tried using aspect-ratio on some cards but one long title just nuked the entire grid layout. tbh it's such a pain when you forget to set min-width to zero.



File: 1793464077629.jpg (148.12 KB, 1024x1024, img_1793464069631_vpeelb1m.jpg)ImgOps Exif Google Yandex

1cd04 No.2309[Reply]

Been seeing way too many headers breaking mid-word on mobile lately. It's honestly painful to look at when you have a nice serif font and the line breaks right after a single character. It totally destroys the visual weight of the headline. I hate it when a huge chunk of whitespace just sits there because the second line only has two letters. If you're dealing with short headings or titles that shouldn't look like a ragged mess, just use text-wrap: balance. It tells the engine to try and distribute the words more evenly across lines. It's not for long paragraphs though, because it'll kill your performance if the browser has to recalculate every single line break in a huge block of text. Just stick to using it on h1 or h2 elements where you want that pretty typographic balance without the heavy lifting.

h1 {text-wrap: balance;}


NEVER USE THIS ON LONG BODY TEXT

I saw a dev trying to use this on an entire article body yesterday and the layout was stuttering like crazy while scrolling. It's great for headlines, but keep it contained.

acb7a No.2340

File: 1793995607746.jpg (59.98 KB, 1880x1253, img_1793995592220_7t4hg0lp.jpg)ImgOps Exif Google Yandex

>>2309
had a client site where an h1 looked absolutely trashed on iphone because of a single trailing letter, so i just dropped that property in and fixed it instantly



File: 1793973850464.jpg (80.07 KB, 1024x1024, img_1793973841420_qwbhd2di.jpg)ImgOps Exif Google Yandex

44489 No.2339[Reply]

I hate seeing huge gaps between cards when you're on tablet sized screens. Setting a fixed gap usually leaves too much dead space on mid-range devices. I've been using a simple media query to scale the gap down as the viewport shrinks so it doesn't look sparse. It keeps the layout tight without needing complex math.

@media (max-width: 768px) {.grid-container {gap: 1rem;}}


don't forget to check your padding too, because a small gap with huge padding looks just as bad. It's much easier than trying to use calc() for every single margin.


File: 1793547338600.jpg (132.4 KB, 1024x1024, img_1793547330983_50v7ey8n.jpg)ImgOps Exif Google Yandex

38b4b No.2313[Reply]

it's driving me crazy how safari jumps around when the address bar hides. using 100vh for a hero section is brilliant a disaster because it cuts off the bottom of the content. i've started sticking to dvh everywhere just to avoid that weird layout shift.

does anyone still bother with the overflow trick?

94bdd No.2335

>>2313
>i've started sticking to dvh everywhere just to avoid that weird layout shift.

dvh is fine until you realize the keyboard pops up and breaks everything. i still use a bit of padding-bottom on my containers because scrolling feels janky when the viewport size changes mid-interaction.

94bdd No.2337

File: 1793920255623.jpg (51.2 KB, 1000x750, img_1793920238799_v6axuawv.jpg)ImgOps Exif Google Yandex

>>2335
>dvh is fine until you realize the keyboard pops up and breaks everything.

the keyboard thing is a nightmare for any input field. i just use min-height: 100svh instead so it stays within the smallest possible viewport. avoids that weird jumping when things resize. also if you're doing something complex with fixed headers, stop trying to calculate offsets manually and just use position: sticky. saves so much headache with z-index issues too. tbh i'm done with calculating math for every single breakpoint



File: 1793669679501.jpg (342.24 KB, 1024x1024, img_1793669670808_n7uryw78.jpg)ImgOps Exif Google Yandex

52020 No.2321[Reply]

been messing with clamp() for my last two client sites because writing out four different breakpoints for font sizes is such a waste of time. it's way cleaner than managing a massive list of @media blocks just to change a single rem value.
>media queries are the only way to be precise
honestly that's just more code to maintain and i'm not trying to copy-paste CSS all day.

font-size: clamp(1rem, 5vw, 2.5rem);


it handles the scaling automatically so you can actually focus on something else for once lol.

a016d No.2327

>>2321
>it handles the scaling automatically so you can actually focus on something else for once lol

The 5vw part makes me a bit nervous though. I tried doing that on a recent project but the text looked way too tiny on some of the smaller tablets I was testing. Did you use a specific tool or calculator to figure out those exact values? I'm still struggling with getting the math right so it doesn't look broken when the viewport hits a weird size. It feels like I'm just guessing at random numbers most of the time. my css is basically just vibes

a016d No.2328

>>2327
>The 5vw part makes me a bit nervous though.

did the same thing on a landing page last month and it looked like microscopic dust on an ipad mini. i stopped using raw vw values and started adding a tiny bit of rem to the middle parameter so there's always a base size even when the viewport shrinks.

font-size: clamp(1rem, 2vw + 0.5rem, 2.5rem);

it's much more stable than just relying on the viewport width alone.

3e630 No.2336

>>2328
Adding rem to the middle value is a decent band-aid but it doesn't really fix the scaling logic. You're just shifting the curve. If you don't want things getting tiny on tablets, you should probably just use a media query for the font size at that specific breakpoint. It's much easier to debug when you can see exactly where the jump happens in the inspector. Using complex math in your clamp function makes it way harder to tell what the actual size is supposed to be at a glance. I usually stick to simple rem values and just let the breakpoints do the work. It's less "clever" but much more predictable for the rest of the team.



File: 1793907574280.jpg (119.5 KB, 1080x721, img_1793907565212_hkwjxdv8.jpg)ImgOps Exif Google Yandex

c9b64 No.2334[Reply]

i'm sick of seeing layout shifts every time a high-res image finally loads. if you're using a grid with varying content, just lock it down with the aspect-ratio property so the browser knows exactly how much space to reserve before the asset even hits the cache.
img {width: 100%;aspect-ratio: 16 / 9;object-fit: cover;}

it's basically non-negotiable for any decent performance score. anyone still relying on the old padding-top hack?


File: 1793590158970.jpg (208.45 KB, 1024x1024, img_1793590150302_bwwiyut3.jpg)ImgOps Exif Google Yandex

4d2f2 No.2316[Reply]

someone's design spec just handed me a nav bar with a fixed 60px height for mobile. it's a disaster once you realize how much space those browser toolbars eat up when they expand and collapse. i'm tired of seeing people ignore the actual visible area of the screen because they're too obsessed with pixel perfection on a static mockup.
>the height should stay consistent across all viewports
it doesn't work like that in the real world.

4d2f2 No.2317

>>2316
>it doesn't work like that in the real world.

Had a designer do this on a recent e-commerce build and it basically broke the entire checkout flow. The bottom nav was constantly overlapping the input fields because they forgot about the safari address bar.

d70f0 No.2323

File: 1793699179995.jpg (201.44 KB, 1024x1024, img_1793699166337_numkccaw.jpg)ImgOps Exif Google Yandex

>>2317
happened to me last month on a travel app. dev team was so focused on pixel perfect layout that they ignored how chrome mobile behaves when you scroll. the bottom tabs covered the flight selection buttons entirely. it was such a mess.

ea576 No.2333

File: 1793900339901.jpg (58.94 KB, 736x920, img_1793900323504_b3xaj2b8.jpg)ImgOps Exif Google Yandex

>>2316
>it doesn't work like that in the real world.
designers love their little static mocks. just finished a site for a local cafe and had to manually override the header height because the spec ignored the notch entirely. absolute nightmare



File: 1793871132075.jpg (518.38 KB, 2000x1701, img_1793871122569_oxz03hvm.jpg)ImgOps Exif Google Yandex

0681f No.2332[Reply]

been messing with width: intrinsic on some sidebar elements lately and it's honestly a mess when the content is unpredictable.
>it just breaks everything
total chaos when you don't hardcode something. anyone else sticking to fixed widths for sidebars despite the "modern" way?


File: 1793828568763.jpg (184.63 KB, 1024x1024, img_1793828560746_bzskwp9f.jpg)ImgOps Exif Google Yandex

f7496 No.2331[Reply]

dealing with that cafe site again where the map overlay keeps stealing the page scroll. if you have a specific element like a custom div or an iframe needing touch interaction, use css to stop it from triggering the main viewport movement.
.map-container {touch-action: none;}

don't use this on the whole body or you'll break the entire mobile experience for your users.


Delete Post [ ]
Previous [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 ]