Page is a not externally linkable
- WebmasterWorld
-- Accessibility and Usability
---- 'Best practice for <label>


D_Blackwell - 5:00 am on Nov 20, 2009 (gmt 0)


A recent thread in another forum had a code sample that wrapped the <label> around the input:

<form action="">
<div>
<label for="sample" id="sample">Label
<input type="text" id="text" value="Initial value." />
</label>
</div>
</form>

However, I have been reading conflicting opinions - that the <label> should contain only itself; and that the label should wrap <form> element with which it is associated. Both validate. W3C shows examples of both, but is, as ever, woeful with examplification.

I have primarily always used the former, but markup for either easy to find - what is best practice for Accessibility - within reason?

456 Berea St. [456bereastreet.com] A couple of years old, but one of the better resources at addressing implicit and explicit association as well as the question of when wrapping (implicit) might be preferable and that using both techniques has its place.

I do my best to accommodate Accessibility, up to a point. I do think that there is a responsibility of developers of screen-readers, et cetera, to do a lot better job of with their software. I don't feel responsible for accommodating users of fractional percentages, but do try to do my best for the most; in part for personal reasons; in part because it makes all of my markup and awareness of considertions/options stronger.


Thread source:: http://www.webmasterworld.com/accessibility_usability/4028566.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com