Перейти к основному содержимому
← 📄 HTML & the platform·Модуль A5 · Урок 4
🐛 Исправьте ошибкуAccessibility audit shipped a bug: body text is #ccc on #fff — contrast 1.6:1, fails WCAG AA. Fix body color to `oklch(0.40 0 0)` (~7.4:1 against white, passes AAA). Use the modern OKLCH pattern from B5 — not a hex.

Цветовой контраст: 4,5:1 для основного текста, 3:1 для крупного текста.

100 XP8 min
Теория

The numbers WCAG requires

For WCAG AA (the legal baseline in most countries):

TypeMinimum contrast
Body text4.5 : 1
Large text (18pt regular, 14pt bold)3 : 1
Interactive UI elements (buttons, focus rings)3 : 1
Decorative (logos, disabled state)none required

For WCAG AAA (stricter — required for some government sites), bump body to 7:1.

Computing contrast

Contrast ratio is a function of relative luminance, not just "how different are the colors." Tools that compute it: Chrome DevTools color picker, axe, WebAIM contrast checker.

/* ✗ Light gray on white — 2.3:1, fails AA */
body { color: #aaa; background: #fff; }

/* ✓ Mid gray on white — 4.6:1, passes AA */
body { color: #767676; background: #fff; }

/* ✓ Dark gray — 7.0:1, passes AAA */
body { color: #595959; background: #fff; }

The common trap: placeholder text

input::placeholder { color: #ccc; }   /* 1.6:1 — invisible to low-vision users */

WCAG considers placeholder text content. It must hit 4.5:1 against the input background.

Dark mode

Dark mode has the SAME requirements. Light gray text on a near-black background frequently fails. Test both modes.

🔒

Зарегистрируйся чтобы кодить

Теория открыта всем. Интерактивный редактор, живой превью и проверка открываются с 7-дневным бесплатным trial — нужна карта, отмена в любое время.

Регистрация — бесплатный trial →

Первые 10 уроков в каждом треке — бесплатные. Карта не нужна.

← НазадСледующий урок →

Получай один совет по Python или веб-разработке — каждый день в почте

Коротко, без воды, без спама. Отписаться — в один клик.