Skip link in HTML helps users jump to important parts of a web page without delay.
What is an HTML Skip Link
A skip link is a hidden anchor placed at the top of a page. It lets users with screen readers or keyboard navigation move directly to the main content. This removes the need to press the tab key many times.
Users who depend on the keyboard need ways to reach content. Skip links give them control to bypass menus and headers that repeat on every page. This makes the site more open for users with limited vision or motor skills.
You place an anchor tag at the top that links to a main content ID. Then you add a target ID on the main content section. The link stays hidden but shows when a keyboard user selects it.
Place the skip link as the first item in the HTML body. Make it visible when a user presses the tab key. Connect it to a landmark area like <main> or a div with id="content".
Here is a quick example:
<a href="#content" class="skip-link">Skip to content</a>
<main id="content">
<h1>Welcome</h1>
<p>This is the main content of the page.</p>
</main>This example adds a skip link that appears when a keyboard user presses tab. It directs the focus to the content area.
Examples of Skip Link in HTML
Skip link with CSS for focus:
<a href="#main" class="skip">Skip to main content</a>
<nav>
<ul>
<li><a href="#">Menu A</a></li>
<li><a href="#">Menu B</a></li>
</ul>
</nav>
<main id="main">
<h1>Main Content</h1>
<p>Some text here...</p>
</main>
<style>
.skip {
position: absolute;
top: -40px;
left: 0;
}
.skip:focus {
top: 0;
background: #eee;
padding: 10px;
}
</style>This example adds CSS that hides the link outside the view. The skip link becomes visible when a user presses tab. It sends the focus straight to the main content area.
Multiple skip links for large sites:
<a href="#main" class="skip">Skip to main</a>
<a href="#footer" class="skip">Skip to footer</a>
<header>
<h1>Site Header</h1>
</header>
<main id="main">
<h2>Page Content</h2>
<p>Lots of details here...</p>
</main>
<footer id="footer">
<p>Contact and links</p>
</footer>This example shows two skip links. One leads to the main section, and the other leads to the footer. This helps users move across long pages without pressing the tab key many times.
Skip link with ARIA landmark roles:
<a href="#main" class="skip">Skip to content</a>
<nav role="navigation">
<ul>
<li><a href="#">Menu X</a></li>
<li><a href="#">Menu Y</a></li>
</ul>
</nav>
<main id="main" role="main">
<h1>Main Content Area</h1>
<p>Text inside the main area...</p>
</main>This example adds ARIA roles to support screen readers. The skip link works with the role="main" landmark, so assistive tools guide the user faster. It improves the experience for people who depend on these tools.
Skip link with smooth scroll effect:
<a href="#content" class="skip">Skip to content</a>
<header>
<h1>My Website</h1>
</header>
<main id="content">
<h2>Main Article</h2>
<p>Page details here...</p>
</main>
<style>
html {
scroll-behavior: smooth;
}
</style>This example uses CSS scroll behavior. The skip link sends the view smoothly down to the content section.
Wrapping Up
You learned what a skip link is and why it matters for accessibility. You also saw how to create them and where to place them. Here is a quick recap:
- You can add it to the main content, and also to big sections like the footer.
- A skip link works like a shortcut, and it lets you jump to the target content.
- You should see it appear when you press the tab key.
- Place it right at the start of the body so you can find it first.
FAQs
What is an HTML skip link in web accessibility?
<a> tag with href like #main
lets users jump to main content.
This helps keyboard users skip navigation.
Example:
<a href="#main">Skip to main content</a>
<nav>...navigation links...</nav>
<main id="main">Main content goes here</main>How do you create a skip link in HTML?
<a href="#main" class="skip-link">Skip to content</a>
<style>
.skip-link {
position: absolute;
left: -999px;
}
.skip-link:focus {
left: 0;
top: 0;
background: #000;
color: #fff;
}
</style>
<main id="main">Your content</main>Why is a skip link important for screen reader users?
- Improves accessibility
- Helps screen readers
- Saves keyboard navigation time
Where should you place an HTML skip link on a page?
<body>
<a href="#main">Skip to content</a>
<header>...menu...</header>
<main id="main">...content...</main>
</body>
Similar Reads
In this article, you will learn how HTML legend works in the fieldset tag with examples. HTML fieldset and legend…
The HTML <cite> tag is a small but important tool for marking up the title of a creative work. You…
The HTML ARIA attributes help users with disabilities use websites. These attributes describe roles and states for tools. Understand the…
The HTML <template> tag lets you store HTML content that won’t show up right away. JavaScript can pull it in…
The dir attribute tells the browser which way text should go in HTML. You use it when a page or…
This article shows you how to open a link in a new tab. Read the code and follow the examples…
The <progress> tag in HTML shows task completion. It gives users visual feedback as the task runs. Understand the <progress>…
The <i> tag stands for "italic." It marks text that has a different voice or tone, such as a technical…
The HTML<kbd> tag shows the keys that a user must press. This helps you to give instructions for commands or…
In this article, you will learn how the browsers read nested lists in HTML and how to use them with…