CSS :focus-visible Pseudo-class
- Previous Page :focus
- Next Page :focus-within
- Go to the Previous Level CSS Pseudo-class Reference Manual
Definition and Usage
CSS :focus-visible
Pseudo-classes that apply focus styles only when focused via keyboard, not via mouse focus.
This can be used with :focus
Combined use, create different focus styles for keyboard focus and mouse/touch focus.
Example
Select and set the style for buttons that are focused via the keyboard Tab key:
button:focus-visible { outline: 2px solid red; }
CSS Syntax
:focus-visible { css declarations; }
Technical Details
Version: | CSS4 |
---|
Browser Support
The numbers in the table specify the first browser version that fully supports this pseudo-class.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
86 | 86 | 85 | 15.4 | 72 |
Related Pages
Tutorial:CSS Pseudo-classes
Reference:CSS :focus pseudo-class
- Previous Page :focus
- Next Page :focus-within
- Go to the Previous Level CSS Pseudo-class Reference Manual