September 24, 2006

Uncommon XHTML Tags, Part 7

The <label> <label> tag. Maybe this is not as uncommon as some other tags, but I was unaware of this tag for a while. This tag is probably most commonly used for radio buttons and helps with website accessibility and usability.

Use this tag to label your radio buttons. When this happens, the user can click on the text for that radio button to select it; the user does not have to select the radio button itself.

<p>What is your favorite color?</p>
<input type="radio" name="color" id="blue" />
<label for="blue">Blue</label>
<br />
<input type="radio" name="color" id="yellow" />
<label for="yellow">Blue, no yellow ahhhhhhh!</label>

What is your favorite color?

Yes, I must have Monty Python's Quest for the Holy Grail on the mind.
Post a Comment