How to encode a label tag for XHTML

The coding style of the tag tag.

Can I write my label tag like this.

<input type="text" name="lname" id="ln" />
<label for="ln">Last Name:</label>

      

Instead of this.

<label for="ln">Last Name:</label>
<input type="text" name="lname" id="ln" />

      

+2


a source to share


1 answer


Yes, although this is bad practice.



UI design conventions place labels in front of controls (unless those controls are radio buttons or checkboxes)

+4


a source







All Articles