WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: label element containing input element

for

From: Neier, Garrett
Date: Jul 1, 2011 8:12AM


Hi All,
This issue was last discussed in 2003. The advice then was to separate the <label> from the form element.
Today, it appears that the technique of enclosing the form element in the <label> is more widely used and part of the spec.
Does anyone know if today's screen readers can handle it?

Example:
<label>
Enter text
<input type=text id=firstname>
</label>

http://www.w3.org/TR/html401/interact/forms.html#edef-LABEL
from
http://stackoverflow.com/questions/774054/should-i-put-input-tag-inside-label-tag

I ask because I would like to create the cleanest html, without resorting to <br> tags between elements.
The only example I found, without <br> tags, has <label> containing the element
http://www.themaninblue.com/experiment/InForm/margin.htm

thank you,
Gary