xHTML syntax question
Is开发者_开发技巧 it proper if I place the tag after the input tag or before or does it matter?
<label for="l">Last Name:</label>
<input type="text" name="lname" id="l" />
<input type="text" name="fname" id="f" />
<label for="f">First Name:</label>
Both are valid XHTML, however for good accessibility it's probably best to have <label>
first so it'll be described by a screen reader before reaching the input itself.
I put the input tag inside the label tag:
<label>Name: <input ... /></label>
That way, the for attribute isn't needed.
no. It doesn't matter. The input can be anywhere on the page for that matter.
精彩评论