What is the tabindex
attribute used for in HTML?
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a way to play audio on a mobile browser w
- HTML form is not sending $_POST values
- implementing html5 drag and drop photos with knock
-
Why does the box-shadow property not apply to a
the values you set determine the order that your keyboard focus will move between elements on the website.
In the following example, the first time you press tab, your cursor will move to #foo, then #awesome, then #bar
If you have not defined tab indexes anywhere, the keyboard focus will follow the HTML tags of you page in the order in which they are defined in the HTML document.
If you tab more times than you have specified tabindexes for, the focus will move as if there were no tabindexes, i.e. in the order of appearance of the HTML tags
Tabbing through controls usually happens sequentially as they appear on the HTML code.
Using tabindex, the tabbing will flow from control with the lowest tabindex to the control with the highest tabindex in tabindex sequential order
The HTML tabindex atribute is responsible for indicating if an element is reachable by keyboard navigation. When the user presses the Tab key the focus is shifted from one element to another. By using the tabindex atribute, the tab order flow is shifted.
When the user presses the tab button the user will be taken through the form in the order 1, 2, and 3 as indicated in the example below.
For example:
Controlling the order of tabbing (pressing the tab key to move focus) within the page.
Reference: http://www.w3.org/TR/html401/interact/forms.html#h-17.11.1
It can be used to alter the default form element focus navigation sequence.
So if you've got:
by using the tab key you navigate through A->B->C. Tabindex allows you to change that flow.