Accessible Forms with XHTML Labels

With the label element, forms would look like:
<form method="POST">
<label for="firstname">First name</label>
<input type="text" name="firstname" id="firstname" />
</form>

This would make the connection between a field and its label machine-readable, enabling easier handling for accessibility purposes.
Also, this mark-up would be slightly lighter to download that the current <div /> solution.

Thanks to Nico for the suggestion.

Label resources

About.com HTML Guide: <label />
XHTML 1.0 schema: Label
DevGuru XHTML Tag: Label


Read more Midgard posts.