Responsywność

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).

poważnastatyczneWCAG 1.4.4 · AAfe-responsive

Dlaczego

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.

Poprawka

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.

Przykłady

/* bad */
.hero__title { font-size: 6vw; }
/* good */
.hero__title { font-size: clamp(2rem, 1.2rem + 4vw, 4rem); }

Źródła

Fakty

Identyfikator
responsive/no-viewport-font-size
Waga
poważna
Sprawdzanie
statyczne sprawdzane w kodzie źródłowym przez audit
Dotyczy plików
css scss less html vue svelte astro
WCAG 2.2
1.4.4, poziom AA
Uczy jej skill
fe-responsive Responsive design
Od wersji
0.1.0

Plik reguły na GitHubie

Przeczytaj w terminalu

npx github:dawidolko/frontend-skills explain responsive/no-viewport-font-size