vw Units and Web Accessibility

Why text sized only in vw ignores browser zoom, and how to fix it while meeting WCAG 1.4.4.

The sites we build should work for everyone, without friction. Yet vw (viewport width) — a unit we reach for because it's convenient — can produce a site where people with low vision simply can't make the text bigger. This article looks at the accessibility (a11y) problems with vw and how to fix them, with real numbers.

1. Why vw text doesn't get bigger

When you zoom a desktop browser with Ctrl +, each CSS px gets larger and the viewport's width in CSS px shrinks by the same factor. Zoom a 1440px window to 200% and the viewport becomes 720px. So text sized only in vw, like font-size: 4vw, is halved in CSS px and then drawn at 2×, which leaves it exactly the same size on screen. Raising the "font size" in browser settings doesn't affect vw either.

2. Before and after zoom: the numbers

Here's the on-screen text size for each approach in a 1440px-wide browser window:

CSS Default 200% zoom 400% zoom 32px font setting
4vw 57.6px 57.6px (1×) 57.6px (1×) 57.6px (1×)
calc(1rem + 1vw) 30.4px 46.4px (~1.53×) 78.4px (~2.58×) 46.4px (~1.53×)
clamp(0.875rem, 0.5rem + 1.5vw, 1.25rem) 20px 37.6px (1.88×) 56px (2.8×) 37.6px (1.88×)
1.25rem 20px 40px (2×) 80px (4×) 40px (2×)

Text sized only in vw doesn't grow no matter what the user does. Mixing in rem lets it grow, but the vw part still doesn't scale with zoom, so the larger the vw share, the less the text grows. Some interpret the criterion as met if text reaches 2× at the browser's maximum zoom (500% in most browsers), but audits usually check at 200% zoom, so it's safer to keep the vw share small.

3. Fix 1: Combine rem and vw

The simplest fix is to add rem, which follows the user's settings, to vw, which follows the screen width.

/* 1rem (16px by default) plus 1% of the viewport width */
h1 { font-size: calc(1rem + 1vw); }

Now when the user zooms the browser or increases the default font size, the 1rem part grows with it. The vw part still doesn't, though, so as the table shows, 200% zoom on a 1440px screen only makes the text about 1.53× larger. There's also no min or max, so it keeps growing on large screens.

4. Fix 2: clamp() with rem

When you use clamp(), base all three values on rem.

/* rem in all three values: 14px at 400px and below → 20px at 800px and above */
p { font-size: clamp(0.875rem, 0.5rem + 1.5vw, 1.25rem); }

Keep the max at no more than 2.5× the min. At 500% zoom, text renders at no less than 5× the min, and the unzoomed size never exceeds the max — so if the max is at most 2.5× the min, the text is guaranteed to reach at least 2× somewhere along the zoom range. The example above is 20 ÷ 14 ≈ 1.43×, so it passes. To get values for the screen range you need, use the clamp generator with the unit set to rem.

5. Don't block zoom

Adding user-scalable=no or maximum-scale=1 to the viewport meta tag disables pinch-zoom on mobile and seriously hurts accessibility. iOS Safari has ignored these settings since iOS 10, but other browsers may actually block zooming.

<!-- Not recommended -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

<!-- Recommended -->
<meta name="viewport" content="width=device-width, initial-scale=1">

6. Other accessibility considerations

  • Reflow (WCAG 1.4.10): content must be readable without horizontal scrolling at a width of 320 CSS px (a 1280px screen at 400% zoom). Widths fixed in vw and width: 100vw are common causes of horizontal scroll. See 6 cases where you should not convert px to vw for examples.
  • Sufficient contrast: keep normal text at a contrast ratio of at least 4.5:1 against its background. Large text (24px and up, or about 18.7px and up if bold) is allowed 3:1, but if responsive sizing shrinks text below that, the 4.5:1 requirement applies. Check it with the contrast checker.
  • Line breaking: so words don't break awkwardly as elements get narrower, use overflow-wrap: break-word (or word-break: keep-all for CJK text) where appropriate.

Conclusion

A truly responsive site responds not just to devices but to people. Keep the convenience of vw, but mix rem into font sizes, never block zoom, and make a habit of checking at 200% zoom and with a larger font setting. To convert mockup px values to rem, use the PX to REM converter; for the difference between clamp() and vw, see clamp() vs vw.

Try it out right awayPX ↔ REM ConverterOpen →

Keep reading