HTML LABEL tag

The HTML LABEL tag is used to programmatically associate a piece of text on the screen with an HTML FORM field like a text input box or a drop down select box.

Example 1 below shows how to use an HTML LABEL. The LABEL’s FOR attribute points the the INPUT’s ID.

Example 2 below shows how to use a TITLE attribute to create a programmatically determinable label where the is no text on the screen.

If there is no onscreen text available you can also use a CSS technique to hide label off the screen.

Example 1:



<label for="firstname">FirstName*</label>
<input type="text" id="firstname">

Example 2:

Expense Month

<table>
<tr>
<th>Expense Month</th>
</tr>
<tr>
<td>
<select title="Expense Month" name=month>
<option>January</option>
<option>February</option>
</select>
</td>
</tr>
</table>

Works With

HTML LABEL ELEMENT
Browser Screen Reader Results
IE 9 JAWS 12 Yes
FF 4 JAWS 12 Yes

Standards:

Comments are closed.