NOT nesting input inside label acceptable?

Iā€™m currently building my survey form challenge, and nesting input inside label makes it hard for me to design it to my liking.
So, from best practices standpoint is it okay to build it like this :

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

Instead of this :

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

Probably a stupid question that nobody ask, but thanks for reading. :grin:

2 Likes

if you use for you can avoid nesting them, yes

1 Like

i had the same doubt. i like nesting though. :wink:

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