Accessibility snippets

CSS accessibility snippets: focus rings, skip links, and WCAG-compliant patterns. Every snippet includes a live demo, copyable CSS, and an LLM-ready prompt.

Widely supported

Color-Blind Safe Palette

Design status indicators and data visualisations that remain distinguishable for users with deuteranopia, protanopia, and tritanopia using shape, pattern, and safe oklch hues.

no-js
Widely supported

Focus-Within Card Highlight

Use :focus-within to highlight an entire card or form group when any child element receives keyboard focus — no JavaScript required.

no-js
Widely supported

High Contrast Mode

Support Windows High Contrast Mode and forced-colors media query — keep UI usable when the OS overrides your color palette.

no-js
Widely supported

Keyboard Navigation Styles

Style keyboard navigation with :focus-visible — show focus rings only for keyboard users, never for mouse users, without any JavaScript.

no-js
Widely supported

Motion-Safe Animation

Write animations inside @media (prefers-reduced-motion: no-preference) so motion is opt-in by default — the safest approach for vestibular-sensitive users.

no-js
Experimental

Prefers Reduced Transparency

Use prefers-reduced-transparency to replace frosted glass and translucent UI with solid alternatives for users who need clearer backgrounds.

no-js
Widely supported

Reduced Motion

Use prefers-reduced-motion to disable or slow animations for users who have requested less motion in their OS settings.

no-js
Widely supported

Skip to content link

An accessible skip-to-content link that appears on keyboard focus using :focus-visible.

Widely supported

Visually Hidden (Screen Reader Only)

The .sr-only pattern hides text visually while keeping it accessible to screen readers — the right way to add context for assistive technology.

no-js
Widely supported

WCAG contrast pair

Choose foreground and background color pairs that meet WCAG AA contrast ratios using oklch() — readable at any size.

no-js