eHow launches Android app: Get the best of eHow on the go.

How To

How to Use the Label Element to Make Online Forms Accessible

Contributor
By Virginia DeBolt
eHow Contributing Writer
(1 Ratings)
A typical form on the Internet
A typical form on the Internet

An important accessibility feature of online forms is the proper use of the label element. A label is a connection between the form element itself and the text explaining what the form field is for. Here is how to use the label element.

Difficulty: Moderate
Instructions

Things You'll Need:

  • A text editor or WYSIWYG HTML editor

    Build Your Form

  1. Step 1

    There are two steps to creating a label. The first is the label itself. With the label element include an attribute called FOR. The FOR attribute tells which actual form element the label is for.

  2. Step 2

    The second step involves matching an ID attribute in the form element to the exact value that was given to the FOR attribute in the label element.

  3. Step 3
    A label with a text field
     
    A label with a text field

    Pictured is an example of a text field in a form asking for a person's name. You can see the HTML in the image. Note that in this example the label will appear before the text field.

  4. Step 4
    A label with a checkbox
     
    A label with a checkbox

    On the other hand, when you use checkboxes in a form, you may want to have the label appear after the form element. This image shows the proper way to do that with HTML and includes a surrounding fieldset and legend for the checkboxes. The fieldset and legend are not necessary for checkboxes, I included them to provide a complete example. Use a similar pattern to place the label after each radio button when making a form with radio buttons.

  5. Step 5
    A label with a select menu
     
    A label with a select menu

    For a select box you use the label only for the instructions on what to select.

  6. Step 6

    Submit and Reset buttons do not need label text. The form control itself gives the text needed.

Tips & Warnings
  • When certain fields are required you can add an asterisk character to the form label text. Explain that required fields are marked with an asterisk at the beginning of the form.
Subscribe

Post a Comment

Post a Comment

Related Ads

  • Have you done this? Click here to let us know.
I Did This
Get Free Internet Newsletters

Copyright © 1999-2010 eHow, Inc. Use of this web site constitutes acceptance of the eHow Terms of Use and Privacy Policy .   en-US Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License. † requires javascript

Demand Media
eHow_eHow Technology and Electronics