CSS basics: Focus-visible states
Keyboard focus needs a visible indicator. focus-visible can provide one without relying on hover.
Current edit
Understand the pattern
Keyboard focus needs a visible indicator. focus-visible can provide one without relying on hover.
Keyboard focus needs a visible indicator. focus-visible can provide one without relying on hover.
Misconceptions to reject
- If the page fits one desktop viewport, no narrower viewport needs checking.
- Hiding all overflow always makes content accessible.
The preview is a sanitized subset, not a full browser compatibility test.
Worked example and expected result
button:focus-visible { outline: 3px solid #164e45; }
button:focus-visible { outline-offset: 3px; }
button { padding: 0.75rem 1rem; }Keyboard focus needs a visible indicator. focus-visible can provide one without relying on hover.
Explain it
Apply it elsewhere
Keep the momentum.
Complete the lab, then explain and apply the pattern.
Next: CSS basics: Cascade reviewTry an incident drillAnonymous lesson and mastery progress lasts for this session. Sign in to keep synced lesson XP between sessions; mastery stays device-local. No speed bonus, lost lives, or hint penalties.