Any differences between wraping the input tag within the label tag and not doing it?

There is any difference between

1. Wraping the input tag within the label tag

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

2. And not wraping the input tag and let them appart

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

Watching the results of the two pieces of the code I realize that the output were the same in both cases , but I want to be sure , that’s why I’m asking to people with more experience if there is any difference

This might help:

1 Like

This is largely for the sake of accessibility. There are a lot of people who interact with our web pages differently and accessibility standards allow them to do so.

1 Like

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