:focus-visible

W3C CSS Snapshot 2026

Match a focused element when the browser determines that a visible focus indicator is appropriate.

On this page

Syntax and values

Value or syntaxWhat it does
button:focus-visibleShows a custom indicator when the browser would normally show focus, such as keyboard navigation.

Try the example

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>:focus-visible</title>
  <style>
button:focus-visible { outline: 3px solid teal; outline-offset: 4px; }
  </style>
</head>
<body>
<button type="button">Open schedule</button>
<button type="button" disabled>Unavailable</button>
</body>
</html>

What to expect Use Tab to move focus to Open schedule and see the outline.

Official references