Using the title attribute

Sometimes you don't have space on the screen to put a label, or that label would interfere with the design. Or, you might need to put two labels on a single control. Screen readers will read the title on form controls. The title also appears as a tooltip when the mouse hovers over the control, so it can function like a hint for some users.

The Form

-

The HTML

<form>
<label for="zip">Zip Code:</label>
<input name="textfield" size="5" id="zip" title="zip 5 digits" type="text" /> -
<input name="textfield2" size="4" title="zip plus 4" type="text" />
</form>

The Form (part 2)

Labrador Retriever Cocker Spaniel
Black
Yellow

The HTML (part 2)

<form class="example" action="demo">
<table>
<th></th>
<th>Labrador Retriever</th>
<th>Cocker Spaniel</th>
</tr>
<tr>
<th>Black</th>
<td>
<input size="20" title="Labrador Retriever - Black" type="text" /></td>
<td>
<input size="20" title="Cocker Spaniel - Black" type="text" /></td>
</tr>
....
</table>
</form>