Categories
HTML Web development

HTML tabindex Attribute

Learn how to use the HTML tabindex Attribute.



HTML tabindex Attribute

The HTML tabindex attribute defines the tab order of an element (when the “tab” button is used for navigating).

The HTML tabindex attribute can be used on all HTML elements.

Syntax:

<element tabindex="number">

number – defines the tabbing order of the element.

Example:

<!DOCTYPE html>
<html>
<body>                                               
<p tabindex="1">This is some text.</p>
<p tabindex="3">This is another text.</p>
<p tabindex="2">...and another text.</p>
                
</body>           
</html>

Output:

Try navigating the elements by using the “Tab” button on your keyboard:

This is some text.

This is another text.

…and another text.


Enjoy coding!

Read also:

HTML action Attribute

HTML dir Attribute

HTML href Attribute