Focus
Keyboard users need a visible current position.
Production CSS must keep the interface usable for keyboard users, low-vision users, zoomed layouts, reduced-motion users and real devices.
.button:focus-visible {
outline: 3px solid var(--focus);
outline-offset: 4px;
}
Production mental model
HTML gives meaning, but CSS can protect or destroy that meaning. A link can become invisible, a focus ring can disappear, text can lose contrast and motion can make a page uncomfortable.
Accessible CSS is practical. It means users can read, navigate, focus, zoom, tap and understand the interface under real conditions.
The goal is not to make a separate accessible version. The goal is to make the normal version strong enough for more people.
Keyboard users need a visible current position.
Text and controls need enough difference from the background.
Reduced-motion preferences should be respected.
Layouts must survive larger text and browser zoom.
Visual model
A clear ring shows where keyboard navigation is.
Foreground and background remain readable.
Movement can be simplified when requested.
Controls stay easy to hit on real screens.
Good CSS versus fragile CSS
.button:focus-visible {
outline: 3px solid var(--focus);
outline-offset: 4px;
}
@media (prefers-reduced-motion: reduce) {
* { scroll-behavior: auto; }
}
* { outline: none; }
.muted { color: #777; background: #777; }
.menu { display: none; }
Rules of thumb
Never remove outlines unless you replace them with an obvious focus-visible style.
A color that looks nice on one surface may fail on another.
Large movement, parallax, spinning and repeated animation need reduced-motion fallbacks.
Real text can resize, translate, copy and remain accessible.
Production layouts should survive 200 percent zoom and longer labels.
Visually hidden content should remain available to assistive tech only when that is intended.
Production thinking
Accessibility is where design quality becomes real. A polished interface that cannot be navigated by keyboard is not finished.
This entire lesson is an accessibility baseline: focus, contrast, motion, target size, readable text and resilient layout.
Add accessibility checks to every CSS review instead of leaving them for the end of a project.
Accessible CSS often supports better structure, clearer navigation and fewer hidden-content mistakes.
Live code lab
The preview runs in an isolated iframe. Links and forms stay inside the practice area, so you can experiment without leaving the lesson.
Mini assignment
Practice assignment
Try it yourself
Self-check
Answer these questions before moving on. Production CSS is not about writing more rules; it is about proving the rules survive real use.
Senior audit upgrade
Do not treat accessibility as a feeling. Run keyboard-only navigation, contrast checks, reduced-motion checks and 200 percent zoom.
Can every interactive control be reached and seen without a mouse?
Check text, muted labels, focus rings and disabled states.
At 200 percent zoom, content should remain usable without broken overlap.