How to Add a Skip to Content Link for Keyboard Users

Keyboard and screen reader users have to tab through your logo, navigation and header links on every page before they reach the content. This guide shows you how to add a "Skip to content" link as the first focusable element, point it at a real main content target, and hide it until a user tabs to it. You will also fix any existing skip links that point to an ID that doesn't exist, which this audit flags as broken.

By Updated ⏱ 15 minutes🎯 Beginner● Low impactAccessibility
Illustration: Skip link to main content fix guide
ACCESSIBILITY · FIX GUIDE Skip link to main content IMPACTEFFORT TIME15 minutes LEVELBeginner

Why it matters

Without a way to bypass repeated blocks, a keyboard user may press Tab 20 to 50 times on every page before reaching the content. 1 (Bypass Blocks, Level A), which is referenced by accessibility laws such as the ADA in the US and the European Accessibility Act. A broken skip link, one whose target ID is missing, is worse than none because it promises a shortcut that does nothing.

Search rankings won't change, but the fix takes minutes and removes a common legal and usability complaint.

✕BeforePressing Tab on example.com focusesthe logo first, or a hidden "Skip tocontent" link points to #content and✓AfterThe first Tab press on example.comshows a "Skip to content" link, andpressing Enter moves focus to <main

What you need

Access to your site's main layout or header template (theme files, layout component or site settings)
Ability to add a small amount of CSS
A desktop browser and keyboard for testing
Optional: the axe DevTools browser extension

Step-by-step fix

1

Give your main content area a unique ID

Find the element that wraps the unique content of each page, below the header and navigation. Ideally this is a <main> element, because a main landmark also helps screen reader users. Add id="main" to it, and tabindex="-1" so browsers reliably move keyboard focus there.

Use only one <main> per page, and make sure no other element on the page uses the same ID.

html
<main id="main" tabindex="-1">
  <!-- page content -->
</main>
Pro tip: If your theme already uses an ID such as #content or #MainContent, reuse it instead of adding a second one. The link and the target only need to match.
2

Add the skip link as the first element in <body>

Place the link directly after the opening <body> tag, before the header, cookie banner or announcement bar. It must be a real <a> element with an href that starts with # and matches the ID from step 1. Use clear text such as "Skip to content" or "Skip to main content".

html
<body>
  <a class="skip-link" href="#main">Skip to content</a>
  <header>…</header>
  <main id="main" tabindex="-1">…</main>
</body>
Pro tip: If a cookie consent banner injects focusable buttons at the top of the body, check that the skip link still comes first in tab order, or at least second after the banner.
3

Hide the link visually until it receives focus

Move the link off screen by default and bring it back into view when it is focused. Do not use display:none or visibility:hidden, because those remove the link from the tab order and screen readers can't reach it. Give the focused state strong contrast so sighted keyboard users can see it.

html
<style>
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip-link:focus {
  left: 16px;
  top: 16px;
  z-index: 1000;
  padding: 12px 16px;
  background: #000;
  color: #fff;
  font-weight: 600;
  text-decoration: underline;
}
#main:focus { outline: none; }
</style>
Pro tip: Only remove the focus outline on the main target (which isn't interactive), never on the skip link itself.
4

Fix any existing skip links with missing targets

Many themes already ship a skip link, and this audit flags it when the href points to an ID that doesn't exist on the page, often after a redesign renames the wrapper. In DevTools, search the Elements panel (Ctrl+F or Cmd+F) for href="# near the top of <body>, then search for the matching id=. If the ID is missing, change either the link's href or the container's id so they match.

Also check that the target isn't inside an element with display:none.

html
<!-- Broken -->
<a class="skip-link" href="#content">Skip to content</a>
<main id="main-content">…</main>

<!-- Fixed -->
<a class="skip-link" href="#main-content">Skip to content</a>
<main id="main-content" tabindex="-1">…</main>
Pro tip: Keep exactly one skip link. Two links pointing to the same place, one of them broken, will still fail.
5

Apply the change to every page template

The skip link belongs in the shared layout, such as the header template, theme layout or root layout component, so it appears on every page automatically. Then check templates that don't use the main layout, for example landing pages, checkout, blog posts, 404 pages and password pages, and confirm each one has both the link and a matching target.

Pro tip: On single-page apps, make sure route changes don't replace the element carrying the ID with one that lacks it.
6

Test with the keyboard and re-run the audit

Load a page, click the address bar, then press Tab once. The "Skip to content" link should appear in the top left. Press Enter, then press Tab again: focus should land on the first link or button inside the main content, not in the navigation.

Finally, run axe DevTools or re-run this audit to confirm that both the bypass and skip-link checks pass.

Pro tip: In Safari on macOS, Tab skips links by default. Enable "Press Tab to highlight each item on a webpage" under Safari > Settings > Advanced, or use Option+Tab.

Platform-specific notes

WordPress

Block themes such as Twenty Twenty-Four and Twenty Twenty-Five add a skip link automatically, as long as the template contains a Group block whose HTML element is set to <main> (Block settings > Advanced > HTML element). If yours fails, open Appearance > Editor > Templates and set the content Group to <main>. For classic themes, edit header.php in a child theme, place the link right after wp_body_open(), and check that its href matches the ID in your theme's main container (often #content or #primary).

Shopify

Dawn and most Online Store 2.0 themes already include a skip link to #MainContent in layout/theme.liquid, with <main id="MainContent">. If it's missing or mismatched, go to Online Store > Themes > ⋯ > Edit code > layout/theme.liquid. Add the link right after <body> and make sure the <main> tag around {{ content_for_layout }} has the matching id. Also check layout/password.liquid and any custom layouts.

Next.js

In the App Router, put the link and <main id="main" tabIndex={-1}> in app/layout.tsx. In the Pages Router, put them in pages/_app.tsx or a shared Layout component. Use a plain <a href="#main">, not next/link, because Link is meant for route navigation. Use the className and tabIndex attributes in JSX.

Webflow

In the Designer, select the main Section and set its ID to main in Element Settings (D). Add a Link Block or Text Link as the very first child of Body, set its link type to Page section and choose that section. Style it with a skip-link class, and use the Focused state in the Selector menu to bring it on screen.

Wix

Wix inserts a "Skip to Main Content" link automatically, and you can't edit the theme markup. If the audit still flags it, run Settings > Accessibility Wizard and make sure the page's main content isn't built entirely from elements placed in the header or footer.

Check that it worked

✅ How to verify

  • Press Tab once after the page loads: "Skip to content" should be the first thing that becomes visible and focused.
  • Press Enter on the link, then Tab again: focus should move to the first interactive element inside the main content, and the URL should end in #main.
  • Run axe DevTools (Chrome or Firefox extension) on the page and confirm there are no "bypass" or "skip-link" issues.
  • Re-run this audit on several templates (home, product or post, 404) to confirm they all pass.

⚠️ Common mistakes

  • Hiding the link with display:none or visibility:hidden, which removes it from the tab order so nobody can use it.
  • Pointing the link at an ID that doesn't exist, for example #content when the container is id="main-content", or that only exists on some templates.
  • Placing the skip link after the navigation or inside the header markup, so users still have to tab through links before reaching it.
  • Using href="#" or a JavaScript click handler instead of a real in-page anchor to an existing ID.

Is this still an issue on your site? Run a free audit — ZORO checks this and 294 other SEO, AI-visibility, accessibility and security signals, with fixes for your platform.

Check my site free

FAQ

Is a skip link required for WCAG compliance?

WCAG 2.4.1 Bypass Blocks (Level A) requires a way to skip repeated content. Landmarks such as <main> and headings can technically satisfy it, but they only help screen reader users. A skip link is the method that also works for sighted keyboard users, so it's the standard recommendation, and it's expected in most accessibility audits.

Should the skip link always be visible?

No. The common pattern is to keep it off screen and show it when it receives keyboard focus. Mouse users never see it, and keyboard users see it on their first Tab press. A permanently visible link is also fine if it suits your design.

Why does my skip link scroll the page but focus stays in the header?

The target probably isn't focusable. Add tabindex="-1" to the target element, for example <main id="main" tabindex="-1">, so the browser moves keyboard focus to it as well as scrolling. Also make sure no JavaScript, such as a smooth-scroll plugin, intercepts clicks on the link and cancels the default behavior.

Do I need more than one skip link?

Usually not. One "Skip to content" link covers the requirement. Very complex pages may add a second one, such as "Skip to search", but every skip link must point to an ID that exists on that page.