Creating Keyboard Shortcuts for Links

Keyboard shortcuts let your visitors select and activate links without using a mouse.

Figure 6.17. Create a keyboard shortcut for a link by adding the accesskey attribute to its tag. The explanatory text (Alt-W, etc.) is optional but helpful.

To add a keyboard shortcut to a link:


Inside the link's tag, type accesskey=".


Type the keyboard shortcut (any letter or number).


Type the final ".


If desired, add information about the keyboard shortcut to the text so that the visitor knows it exists.

Figure 6.18. There's no way to tell if a link has a keyboard shortcut unless you've labeled it as such.


  • On Firefox (Mac/Win) and Explorer for Mac, typing a keyboard shortcut activates the link, but on Explorer for Windows, it merely gives focus to the link and the visitor must still press Return to actually follow it.

  • On Windows systems, to invoke the keyboard shortcut, visitors use the Alt key plus the letter you've assigned. On a Mac, visitors use the Control key, plus the letter.

  • Keyboard shortcuts don't work at all in Opera and are unreliable with frames, unless the visitor selects the framewhich kind of defeats the purpose.

  • Keyboard shortcuts that you choose can (annoyingly) override the browser's shortcuts. For example, in most Windows programs, Alt-F is for accessing the File menu. If you use Alt-F for a keyboard shortcut, your visitors won't be able to use the keyboard to access their browser's File menu.

Figure 6.19. When the keyboard shortcut is used, the link is immediately accessed (and the corresponding page is shown).

HTML, XHTML, & CSS(c) Visual QuickStart Guide
HTML, XHTML, and CSS, Sixth Edition
ISBN: 0321430840
EAN: 2147483647
Year: 2004
Pages: 340

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: