concept

Focus appearance — CSS reference

A focus indicator shows which control receives keyboard input. Keep a clear contrast against neighboring colors and avoid clipping by overflow or obscuring by overlays. WCAG 2.2 Focus Appearance (2.4.13) is AAA; Focus Visible is AA. A 3px outline is a useful example but does not alone establish compliance.

Formal Syntax & Structure

css syntaxcss
:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 3px; }

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>focus-appearance</title><style>body{margin:8px;font:16px/1.5 sans-serif;color:black;background:white}#a{box-sizing:border-box}#a:focus-visible{outline:3px solid #1d4ed8;outline-offset:3px}</style><body><button id="a">Save</button></body></html>
CSS Reference