pseudo-class

:focus-visible — CSS reference

Matches focused elements when the user agent determines a visible focus indicator is appropriate. It is not strictly equivalent to keyboard input.

Formal Syntax & Structure

css syntaxcss
:focus-visible

Working Example

Example Snippetcss
<!doctype html><html lang="en"><head><meta charset="utf-8"><title>Selector lab</title><style>:where(.sample) { color: rgb(32, 32, 32); }input:focus-visible { color: rgb(0, 96, 80); }</style></head><body><label>A <input id="a" class="sample"></label><button id="b" class="sample">B</button></body></html>
CSS Reference