Fieldsets and Legends
Difficulty: Advanced
Category:
- Structure
- Presentation
Groups of checkboxes and radio buttons often have a higher-level description that indicates the purpose of the grouping. In such cases, a fieldset and legend should be used to visually identify the grouping and to ensure that the higher-level legend is read by assistive technologies.
<fieldset><legend>Choose your shipping method</legend>
Radio buttons for shipping options
</fieldset>
Fieldsets can be used for groupings of other types of form elements (e.g., “Shipping Address” vs. “Billing Address”), but should be used with care because the legend is identified for each form element in the fieldset.
For more information, see Creating Accessible Form Controls