WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: labels in forms

for

From: Patrick H. Lauke
Date: May 31, 2007 5:50PM


Jon May wrote:
> Hi all,
>
> I'd like some clarity on labels in forms please. Is it OK to put <label
> for="fname"> if it for a first name input box or is it better to put
> <label for="firstname"> or even <label for="first name">. I wasn't sure
> if screen readers and the like actually read the value in the label and
> whether it is best to have something in there that actually makes sense
> to the visitor or if it is fine to use abbreviations.

the for attribute points to a matching id attribute. both are
machine-readable data, which is not directly exposed to the end user
(not even in screen readers).
http://www.w3.org/TR/html401/interact/forms.html#adef-for

oh, and your third example is invalid, as ids and names can't contain
spaces.
http://www.w3.org/TR/html401/types.html#type-name

P
--
Patrick H. Lauke