Creating a Skip Navigation Link That is Only Visible When it Receives Keyboard Focus

Adding a "Skip Nav" link to your design can sometimes compromise the look and feel of the page.  Moreover it can confuse those visitors who have no idea what it means.

A good solution is to create a Skip Nav link that is only visible when it receives keyboard focus.  This happens as a user is tabbing through the page.

To do so, use the following styles and markup:

Styles:

#skip a,
#skip a:hover,
#skip a:visited
    {
    position:absolute;
    left:0px;
    top:0px;
    width:0px;
    height:0px;
    overflow:hidden;
    }

#skip a:active,
#skip a:focus
    {
    width:auto;
    height:auto;
    }

Markup:

<div id="skip">
    <a href="#skip">Skip Nav</a>
</div>

<p><a name="skip"></a>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>

Leave a Reply