Skip link
A skip link lets a keyboard user jump past the header and its menus straight to the content, instead of tabbing through every link first. It is the first link on the page and stays out of sight until it has focus. This page has one: reload it, press Tab once, and it appears at the top left.
The link
No class is needed. A link that is the first child of the body is the skip
link: the stylesheet keeps it above the top of the screen and slides it into view when
it takes focus, so it never covers the page for anyone not using a keyboard. A screen
reader finds it either way, because it is only moved, never hidden.
Its target is the main element, which takes id="main". That
id is a link target, which is what ids are for; nothing styles it.
The link only works as the first thing in the body, so it cannot sit in a box. The box beside the code is a stand-in that shows the link as it looks once it has focus; the real one waits at the top of this page.
<body>
<a href="#main">Skip to content</a>
<header>…</header>
<main id="main">…</main>
</body>
Where it lands
Following the link scrolls to the start of main, clear of the sticky header,
and moves the keyboard's starting point there too: the next Tab goes to the first link in
the content, not back into the header.
Keep the text plain and the same on every page, such as "Skip to content", and keep the link first, before the header, so it is the first thing a keyboard user meets.
When a page needs one
Any page with a header full of links before its content: a site menu, a section bar, a search box. Each of those is a Tab stop, and on this site the header holds more than twenty of them. A skip link turns all of those into one key press.