Label for radio buttons is that mandatory..?

Tell us what’s happening:

Is it mandatory to use label tag to create radio buttons? I tried creating radio buttons without label tag and I can see them on the webpage without any issues. My code is as follows. Can anyone explain me the differences between these two? and where to use the first and the second. If possible give me a real time example. Thank u :slight_smile:

Your code so far

     <input type="radio" name="indoor-outdoor">Indoor
<input type="radio" name="indoor-outdoor">Indoor<br>

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36.

Link to the challenge:

Hi @AdithyaLovesall

A label is used to associate text with form elements so it isn’t required, however, it is used be accessibility devices so it is recommended to use.

Thank u… do u mean to say there will be no issues if we use label r not to use it n its upto us… so using and not using label returns the same result… Is this what u r saying r did i get u wrong…???

Yes, labels aren’t mandatory and it won’t render any differently, but they are recommended.

Thank u @joesmith100 for clarifying my doubt… :slight_smile: