Responsive layout
responsive/no-viewport-font-size
Text is never sized with viewport units alone (font-size 5vw); fluid type mixes in rem, as in clamp(1rem, 0.9rem + 1vw, 1.5rem).
seriousstaticWCAG 1.4.4 · AAfe-responsive
Why
Viewport units follow the window, not the zoom level or the browser's text size. Text set to 5vw stays the same size when someone zooms in, so it may never reach the 200% that low-vision readers need.
Fix
Mix a rem part into the formula and bound it with rem: font-size: clamp(1.75rem, 1.2rem + 2vw, 3rem). Keep the maximum no more than about 2.5 times the minimum so zoom can still double the text. Check at 200% zoom.
Examples
/* bad */
.hero__title { font-size: 6vw; }
/* good */
.hero__title { font-size: clamp(2rem, 1.2rem + 4vw, 4rem); }Sources
Facts
- Id
responsive/no-viewport-font-size- Severity
- serious
- Check
- static checked in the source by
audit - Applies to
cssscsslesshtmlvuesvelteastro- WCAG 2.2
- 1.4.4, level AA
- Taught by the skill
fe-responsiveResponsive design- Since version
- 0.1.0
Read it in the terminal
npx github:dawidolko/frontend-skills explain responsive/no-viewport-font-size