Your 768px breakpoint is wrong on foldables — what the cover and inner screens actually report

2026-11-24来源 dev.to CSSEnglish

Almost every responsive layout is tested at two sizes: something around 390×844, and something wide. Then a foldable shows up, the user unfolds it, and the page does one of two things — stretches a phone layout across 750 px, or jumps to a two-column tablet layout with a vertical strip of dead space running down the middle of the text.

Neither is a rendering bug. Both are assumptions: that a device has one viewport, that width alone tells you the layout, and that the breakpoints you picked sit somewhere real.

A foldable is two viewports, not one

Here are the CSS pixel widths of the eight devices I keep in the test set (cover screen / unfolded inner screen):

Device Cover Inner
iPhone Duo 387 790
Galaxy Z Fold 7 412 750
Galaxy Z Flip 7 361 411
Mate X7 411 842
Pixel Fold 412 790
Find N5 412 824
Mate XT (tri-fold) 384 1080
Razr 60 Ultra 412 412

Two things fall out of that table immediately.

Cover screens are narrower than the phone you tested. The range is 361–412. If your layout is tuned at 390 and you have a breakpoint at 380 or a hard-coded min-width: 390px on a card grid, the smallest foldable cover lands just under it and gets the "narrow" treatment while a 412 px cover gets the other one.

There is a 338 px hole between 412 and 750. No phone occupies it. No tablet occupies it either — tablets start around 768. Every breakpoint you place between 412 and 750 is dead code that only ever fires on a device you did not think about.

Why 768 is the worst number in this range

Galaxy Z Fold 7 unfolded is 750 px. Your @media (min-width: 768px) does not fire. The user gets the single-column phone layout on a screen roughly the size of an iPad mini.

Mate X7 unfolded is 842 px. Same breakpoint fires. Two columns, desktop nav, everything.

So two people, same app, same OS version, comparing screenshots of "the foldable experience", see different products. The difference is 92 px of viewport width and no product decision behind it.

The fix is not "move the breakpoint to 720". There is no width that makes one layout correct for both a folded phone and an unfolded tablet, because those are different postures, not different widths. Width is a proxy for posture, and it is a bad one.

Ask the OS how many segments there are

Chromium exposes the Viewport Segments API. Instead of guessing from width, you ask whether the viewport is currently split into two panes and how wide each one is:

/* Structure changes only when there are actually two panes */ @media (horizontal-viewport-segments: 2) { .app { display: grid; grid-template-columns: env(viewport-segment-width 0 0) env(viewport-segment-width 1 0); } .pane-right { padding-inline-start: env(viewport-segment-left 1 0, 0px); } } 

env(viewport-segment-width 0 0) means "width of segment column 0, row 0". The last two numbers are column index, row index, which matters on a tri-fold where you can have three segments in a row — Mate XT at 384/1080 can present 2 or 3.

The point of using the API rather than a media query is that it keeps working when the OS changes its mind mid-session: unfold, fold, drag the app into split-screen, rotate. A width breakpoint has to be re-evaluated and re-designed for each of those. A segment query just asks again.

Where the API is not available, the honest fallback is not another width breakpoint. It is a layout that degrades gracefully in one column, with a max content width around 640 px, so a 750 px canvas shows a centered reading column instead of a stretched one.

Height breaks before width does

Every foldable in that table is 800+ px tall unfolded. Folded, the cover screen is about 850 px tall — and then the OS eats it:

  • keyboard open → dvh drops to roughly 450–500
  • split-screen with a video app → half the height
  • browser chrome on the cover screen → 60–90 px of the 850 gone before your CSS runs

height: 100vh on a hero section and position: fixed on a bottom bar are the two things that break first. The hero overflows, the bottom bar covers the last row of the form, and the user cannot scroll to the button because the bar is fixed over it.

.hero { min-height: 100svh; } /* stable, ignores dynamic toolbars */ .screen { height: 100dvh; } /* tracks the real dynamic viewport */ .cta-bar { padding-bottom: max(12px, env(safe-area-inset-bottom)); } 

Then test at 387×450, not just 387×850. That is the state where the keyboard is up and the user is trying to submit something.

The crease is a layout element

On a book-style foldable the hinge occupies a band in the middle of the inner screen. Content that crosses it is not broken — it is bisected. I have seen pricing tables where the middle column sat exactly on the seam and was unreadable in one orientation only.

The rule I use: structure may cross the crease, text may not. Two panes, a gutter, a divider line — fine. A paragraph, a table row, a button spanning both panes — no.

If you are not using segment queries, the cheap version is a centered gutter:

@media (min-width: 700px) and (max-width: 900px) { .content { padding-inline: 24px; column-gap: 40px; } } 

It is approximate. It costs nothing, and it prevents the worst case.

viewport-fit=cover is not optional anymore

<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"> 

Without it, the browser letterboxes the page to avoid the rounded corners and the camera cutout. On a 387 px cover screen that costs you roughly 20 px per side — you are designing for 347 px and do not know it. With it, you own the edges and use env(safe-area-inset-*) to keep tap targets out of the corners.

The matrix I actually run

Sixteen to thirty-two viewports is not a lot of work if it is a checklist rather than a manual review:

  1. No horizontal scrollbar at any of the eight cover widths.
  2. No text crossing the 40 px band in the centre of the inner screen.
  3. Primary CTA reachable at 387×450 (keyboard-up state).
  4. Two-pane layout appears only when horizontal-viewport-segments: 2.
  5. No fixed bar overlapping form fields.
  6. Images not upscaled past 1× on the inner screen — a 790 px canvas showing a 400 px asset is a blurry hero.

Doing this by hand means resizing a browser window and lying to yourself about which device you are simulating — a 750 px window on a laptop is not a Z Fold 7, because the OS behaviour around segments, safe areas and posture does not come with it.

I built FoldCheck for exactly this: paste a URL, it renders the page inside faithful device frames at those eight widths, runs a 12-point foldable audit, and returns the offending selectors as a CSS patch you can drop into the bundle. It runs in the browser, no signup, and there is a CLI and a small SDK if you want the checks in CI.

The device shipped. The CSS did not get updated. Testing 390 and 1440 is not a matrix — it is a habit.

原文:https://www.a8q9.cn/en/article/your-768px-breakpoint-is-wrong-on-foldables-what-the-cover-and-inner-screens-act-0e29cd.html

相关文章