Home / Fix guides / Accessibility (WCAG)

How to add a skip to content link

A skip to content link is a small link at the top of every page that lets keyboard users jump past the menu straight to the main content. To add one, place a link as the first focusable item on the page, point it at your main content area, and keep it hidden until it receives keyboard focus.

Most visitors never see a skip link, and that is fine. It is built for people who navigate with the Tab key instead of a mouse, including screen reader users, people with motor disabilities and anyone who cannot use a trackpad. Without it, they must tab through your whole header and menu on every single page before reaching anything useful. This page explains what to look for, how to add the link, and how to check it works.

What the problem is and what people see

When a page loads and you press Tab, focus moves from one link or button to the next. On a typical business site that might be the logo, a phone number, eight menu items, a search box and a basket link. That is 12 or more key presses before the first line of real content. Repeat that on every page and it becomes tiring or impossible.

A skip link solves this. It is the very first thing you reach when you press Tab. It usually reads "Skip to content" or "Skip to main content". Pressing Enter moves focus past the header to the main part of the page. Most skip links stay invisible until focused, then appear in a corner of the screen.

The problem is simply that this link is missing, or it exists but does not work (for example, it points to an ID that is not on the page, or it is hidden in a way that keyboards cannot reach).

Why it matters

This is an accessibility requirement. WCAG success criterion 2.4.1, Bypass Blocks (Level A), asks for a way to skip blocks of content that repeat on every page. A skip link is the most common way to meet it. Level A is the baseline, so accessibility audits and legal complaints often start there.

It also affects real customers. If someone cannot get to your product list, booking form or contact details without a long tab journey, some of them will give up. It is a small fix with a clear benefit, and it shows care for all your visitors.

It does not directly change your search rankings, but clean page structure (a proper main content area, sensible headings) tends to go together with a well-built site.

How to check if your site has it

You do not need any tools for the first test.

  1. Open your home page in a normal browser window.
  2. Click once in an empty area of the page, then press Tab once. (If you start from the address bar, Tab moves through the browser's own controls first.)
  3. Look at the top of the page. A "Skip to content" link should appear, usually top left.
  4. Press Enter. The next Tab press should land on the first link or field inside your main content, not back in the menu.

If nothing visible appears, or the first Tab goes to your logo or menu, the link is missing or broken. Test a second page type too, such as a product or blog page, since templates can differ.

Free tools can confirm it. The Lighthouse accessibility audit in Chrome DevTools and the axe DevTools browser extension both report when a page has no way to bypass repeated blocks. The WAVE extension is also useful for spotting structure problems.

How to fix it in general

A working skip link has three parts: the link, a target, and a bit of styling.

  1. Add the link as the first element inside the <body> tag, before the header.
  2. Give your main content area an id, for example main-content.
  3. Point the link at that ID with href="#main-content".
  4. Style it so it is hidden off screen until focused.

Example markup:

<body>
  <a class="skip-link" href="#main-content">Skip to content</a>
  <header>...</header>
  <main id="main-content" tabindex="-1">...</main>
</body>

Example styling:

.skip-link {
  position: absolute;
  left: 8px;
  top: -100px;
  padding: 8px 16px;
  background: #000;
  color: #fff;
  z-index: 1000;
}
.skip-link:focus {
  top: 8px;
}

A few details that often go wrong:

  • Do not hide the link with display: none or visibility: hidden. Keyboards cannot reach it then. Moving it off screen until focus, as above, works.
  • The tabindex="-1" on the target helps some browsers actually move keyboard focus there. It does not add a new tab stop.
  • Use the <main> element for the target if your theme has one. If your theme has no main area at all, a wrapper <div> around the page content with an ID will do.
  • Keep the colours readable when the link appears. See low text contrast for how to check this.

Platform notes

Menus and file names differ between versions and themes, so treat these as pointers.

  • WordPress: many modern themes already include a skip link, so check your theme first. If you are adding one, it usually goes in the theme header template right after the opening body tag (classic themes often use the wp_body_open hook). Use a child theme so updates do not erase it. Step by step: WordPress guide.
  • Shopify: the free Dawn theme includes a skip link by default, but older or customised themes may not. It is added in theme.liquid, and the main content area needs a matching ID. See the Shopify guide.
  • Wix, Squarespace, Webflow: the options depend on the editor and template. Some give you an accessibility setting or a custom code area, others let you add a link element at the top of the page and give your main section an ID. In Webflow you can add a link element as the first item in the body and set the ID on your main section.
  • Drupal: core themes such as Olivero normally ship with a skip link to #main-content. If a custom theme lost it, check that the page template still prints it.
  • Next.js and other frameworks: add the link in your root layout before the header, and put the ID on the <main> element.

If you do not edit code yourself, send your developer the example above and the test steps in this page. It is usually a short job.

How to confirm the fix worked

Repeat the keyboard test on the live site, not just a preview. The link should appear on the first Tab press, be clearly visible, and after Enter the next Tab should land inside the main content. Test with a screen magnifier or browser zoom at 200 percent as well, to make sure the link does not appear behind other elements.

Then rerun Lighthouse or axe and confirm the bypass warning has gone. If focus jumps somewhere odd afterwards, the next thing to look at is tab order.

How to stop it coming back

Skip links disappear when someone switches themes, edits a header template or rebuilds a page layout. Add "press Tab on the home page" to your checklist for any redesign or theme update. If a developer builds your site, ask for the skip link to be part of the base template so it applies everywhere.

An accessibility check run on a schedule catches regressions. SiteMonday covers this in week 7, the WCAG 2.2 accessibility audit, which ends with a written report and a ranked fix list. SiteMonday finds and explains the problem; the fix itself is for you or your developer.

Step by step for your platform

Questions

Is a skip to content link required by law?

The rule behind it, WCAG 2.4.1 Bypass Blocks, is a Level A criterion, and many accessibility laws and standards point to WCAG. Whether it is legally required depends on your country and type of business, so ask a professional if you need certainty.

Should the skip link be visible all the time?

No. It is normally hidden until a keyboard user tabs to it, then it must be clearly visible. Keeping it visible all the time is also allowed if it suits your design.

Do I still need one if my page has a main element?

Landmarks like `<main>` help screen reader users jump around, but sighted keyboard users cannot use them. A skip link helps everyone who tabs, so it is worth adding anyway.

Where should the skip link go in the page?

It should be the first focusable item in the page, directly after the opening body tag and before the header and menu. If something else comes first in the tab order, the link is less useful.

Why does my skip link do nothing when I click it?

Usually the link points to an ID that does not exist on the page, or the ID is spelled differently. Check that the `href` value after the # matches the `id` on your main content exactly.

Can I use a plugin or app to add it?

Sometimes, but quality varies and some add overlays that cause other problems. A small code change in your theme is usually more reliable, and you can test it in under a minute.

Related problems