Hey everyone
When it comes to associating a label with an input element, is there a recommended way of doing things / best practice? Is it preferred to do explicit association (giving the label element a for attribute matching the input element’s id), implicit association (putting the input element inside the label element), or both, or does it not really matter?
Explicit association example:
<label for="fname">First Name: </label>
<input type="text" name="fname" id="fname">
Implicit association example:
<label>First Name: <input type="text" name="fname"></label>
Both:
<label for="fname">
First Name:
<input type="text" name="fname" id="fname">
</label>
Thanks!