However, most apply an important accessibility benefit: if you click the label, it gives focus to the corresponding form control (in other words, it selects the form control related to the label). Note that the id attribute ??”absent from the form example earlier in the chapter??”is required for this. If it??™s absent, clicking the text within the label element won??™t cause the browser to do anything. The fieldset element enables you to group a set of related form controls to which you apply a label via the legend element.
A full list of controls is available in Appendix A (XHTML Reference). THE ESSENTIAL GUIDE TO CSS AND HTML WEB DESIGN 318 As you can see from the previous screenshot, these elements combine to surround the relevant form fields and labels with a border and provide the group with an explanatory title. Adding tabindex attributes The tabindex attribute was first mentioned in Chapter 5 (in the ???Using accesskey and tabindex??? section). For forms, it??™s used to define the page??™s element tab order, and its value can be set as anything from 0 to 32767.