Setting the Tab Order for Links

Some browsers let users navigate through the links, image maps, and form elements with the Tab key. You can determine a custom tab order, to emphasize certain elements.

To set the tab order:

In the link’s tag, type tabindex="n", where n is the number that sets the tab order.

✓ Tips

  • To activate a link the visitor must tab to it and then press Enter.

  • The value for tabindex can be any number between 0 and 32767. Use a negative value to take a link out of the tab sequence altogether.

  • By default, the tab order depends on the order of the elements in the (X)HTML code. When you change the tab order, the lower-numbered elements are activated first, followed by higher-numbered ones.

  • Elements with the same tab index value ...

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.