An HTML page must have a link at the top before the navigation that allows users to skip lengthy navigation and proceed to a page’s main content.
Screen readers announce content sequentially as it appears in an HTML file. Assistive technology will focus on the content at the top of the page first, which is often lengthy. This can be time-consuming for users who are only interested in the main content. Including a skip link in an HTML page aids blind users, people with low vision, and mouse-only users.
Developers should ensure that all skip links on a web page have a focusable target that allows users to skip the navigation.
Place the skip navigation link at the top of the page right after the opening body tag.
Use the following markup to add a skip link:
<div id="skip">
<a href="courses/html-css/navigation/skip-navigation#content">Skip Content</a>
</div>
Copy
Unfortunately, WebKit-based browsers such as Safari and Chrome have a bug that prevents same-page links from working as they should. You can create a workaround for these browsers using Javascript.
If you decide to hide the skip-link, don’t hide it using any of these CSS options:
Hiding the skip-link with CSS works fine for screen reader users, but this removes access to the link for sighted users who benefit from the skip link. Setting either display: none; or visibility: invisible; properties make the link inaccessible to everyone. The following two accessible approaches to deal with skip links are best practices:
To implement the CSS approach best practice to the markup above, include the following CSS code:
#skip a {
display: block;
position: absolute;
left: -999px;
top: -999px;
}#skip a:focus {
left: 0;
top: 0;
padding: 3px;
background: #ffc;
border:1px solid #990000;
}
Copy
You may also wish to add more skip links for users to skip past repetitive content.