Accessibility: Forms

XHTML has tags and attributes that help associate form controls with labels and other informative text. These help users with disabilities as well as making your forms easier to use for a typical visitor to your site.

Fieldset and Legend

  1. Wrap a <fieldset> around <input>s to group multiple options for a given question.
  2. Create a <legend> inside the fieldset for

Label

  1. Place an id on a form control.
  2. Create a <label> for your control that includes a text label.
  3. Associate the label with the control using the "for" attribute

    <label for="question1">What is your name?</label>
    <input type="text" id="question1" />

  4. Clicking on a control's label will give the control focus.

Previous: Tables

Next: Rich Media