<button class="default-outline">
  Default (Outline in focus)
</button>
<button class="focus-visible-outline">
  Outline Only Focus Visible
</button>
<button class="no-outline">
  No Outline
</button>
body {
  background: #444;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

button {
  background-color: #e6e6e6;
  padding: 10px;
  border: 0;
  border-radius: 5px;
  color: #555;
  font-weight: 700;
  font-size: 16px;
  margin-right: 10px;
  cursor: pointer;
}

.focus-visible-outline:focus-visible {
  outline: red solid 2px;
}

.focus-visible-outline:focus:not(:focus-visible) {
  outline: 0;
}

.no-outline:focus {
  outline: 0;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.