I've a doubt related to the input text, there is any good practice related to the input text?I'm NOT talking about the relation between (id) and (for) or (name)

Tell us what’s happening:

  • There is any difference between writing the input text next to the input tag and writing it next to the label tag?

1. Input text next to the input tag (Look the outdoor and indoor text next to the input tag)

<label for="indoor">
<input id="indoor"type="radio" name="indoor-outdoor">Indoor
</label>
 
 <label for="outdoor">
   <input id="outdoor" type="radio" name="indoor-outdoor">Outdoor
   </label>

2. Input text next to the label tag (Look the outdoor and indoor text next to the label tag)

<label for="indoor">Indoor
<input id="indoor"type="radio" name="indoor-outdoor">
</label>
 
 <label for="outdoor">Outdoor
   <input id="outdoor" type="radio" name="indoor-outdoor">
   </label>

Also if there is a good practice aobut it , I would like to know it
(I’m not talking the good practice about the relations between the attributes ID , FOR and NAME)

As far as I can tell, the only difference here is which side the label is on. Neither is better - it just depends on how you are putting things together on the page.

You can read here about the standards for how label is used.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.