:focus-visible
The CSS :focus-visible pseudo-class matches a focused element when the browser determines that a visible focus indicator is appropriate.
Architecting Accessibility
A CSS pseudo-class that matches an element when the browser determines that a visible focus indicator is appropriate.
- How it is used
- Styles focus indicators when the browser deems them useful, especially during keyboard navigation.
- How deep it goes
- Shows a working CSS rule and testing guidance, but does not explain the browser’s decision process.
- Examples
- Uses a two-color CSS focus rule and Tab-and-Shift-Tab testing across light, dark, and image backgrounds.
- What you can do after
- Operate/configure it in CSS to display a conspicuous focus indicator when the browser considers one useful.
Read how Architecting Accessibility explains :focus-visible →
Tiny CSS Projects
The CSS :focus-visible pseudo-class matches an element when its focus should be indicated to the user, typically during keyboard navigation.
- How it is used
- Marks keyboard focus visibly on card actions, form controls, and a share button without applying the same treatment to mouse focus.
- How deep it goes
- Shows working selectors and focus-style declarations, including invalid-field handling, but does not examine browser matching internals.
- Examples
- Uses profile-card actions, focused form controls with invalid states, and a share button with a hover-or-focus outline.
- What you can do after
- Applies it via CSS to make keyboard focus apparent while tailoring the indicator to links, buttons, and form fields.
Also covered in
- Vanilla WebIn early access (MEAP)
Related concepts
- focus pseudo-classcontrasts with · The CSS :focus pseudo-class matches an element while it has input focus, regardless of how that focus was acquired.
- pseudo-classkind of · A CSS pseudo-class is a selector construct that matches elements according to a state, condition, or structural relationship.
- universal selectorused by · The CSS universal selector, represented by an asterisk, matches elements of any type within a document or selected scope.
- focus indicatorimplements · A focus indicator is a visible cue showing which interface element currently has keyboard or programmatic focus.
Questions about :focus-visible
What is :focus-visible?
The CSS :focus-visible pseudo-class matches a focused element when the browser determines that a visible focus indicator is appropriate.
Which Manning books explain :focus-visible?
Architecting Accessibility and Tiny CSS Projects.
What is the difference between :focus-visible and focus pseudo-class?
The CSS :focus-visible pseudo-class matches a focused element when the browser determines that a visible focus indicator is appropriate. The CSS :focus pseudo-class matches an element while it has input focus, regardless of how that focus was acquired.
What is :focus-visible a kind of?
:focus-visible is a kind of pseudo-class. A CSS pseudo-class is a selector construct that matches elements according to a state, condition, or structural relationship.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

