
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: