Ancient Temple City

Should I put input elements inside a label element?

The label itself may be positioned before, after or around the associated control.

Example 1:

<label for="lastname">Last Name</label>
<input type="text" id="lastname" />


Example 2:

<input type="text" id="lastname" />
<label for="lastname">Last Name</label>


Example 3:

<label>
   <input type="text" name="lastname" />
   Last Name
</label>


Note that the third technique cannot be used when a table is being used for layout, with the label in one cell and its associated form field in another cell.

Either one is valid. I like to use either the first or second example, as it gives you more style control.
Labels:
Reactions:

Post a Comment

[blogger]

MKRdezign

{facebook#http://www.facebook.com/GTVCreations} {twitter#http://www.twitter.com/GTVCreations} {google-plus#http://www.google.com} {pinterest#http://www.pinterest.com} {youtube#http://www.youtube.com} {instagram#http://www.instagram.com}

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget