Dev Helpers
← Back

Reveal a skip link on keyboard focus

Reveal a skip link on keyboard focus with native CSS. The preview includes a small shared demo stylesheet.

Open this example in the interactive library

Source code

<style>
  .demo:not(:focus) {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
</style>
<div>
  <a class="demo" href="#main">Skip to content</a>
  <p id="main" tabindex="-1">Tab into the preview to reveal the link.</p>
</div>