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
The <dialog> tag is used to build modal popups in HTML. It shows alerts and messages without third-party scripts. Understand…
HTML global attributes work on most elements. They do not depend on the tag name. You can use them with…
HTML form validation attributes help you check the form data before it reaches the server. What Are HTML Form Validation…
Use the HTML object tag to embed different types of external files into your webpage. It works for videos and…
This article shows you how to open a link in a new tab. Read the code and follow the examples…
You need images to show products or ideas on your site. The HTML img tag places those images on the…
The HTML sup tag puts text above the normal line. Writers use it for math power and marks. So, readers…
The HTML form tag helps you collect user input on a website. You use the HTML form tag to create…
The link tag in HTML connects a web page to external resources like stylesheets or icons. It's placed in the…
The <main> tag in HTML marks the central content of a webpage. It tells browsers and assistive technologies where the…