Saqib Ishfaq13,609 Points
what's the reason he used<input> element 1st and then used <label> and gave for and class to it!
opposite to what he has done previously, and din't separate them either... wouldn't it be easier if he had? shall we think it's a best practise while using type="radio" or something else? i just wrote the way i thought was better for me to understand , and it worked exactly the same!!
<label>Age:</label> <label for="under_13" class="light">Under 13</label> <input type= "radio" id="under_13 "value="under_13" name="user_age"> <br> <label for="over_13" class= "light">Over 13</label> <input type="radio" id="over_13" name="user_age" value="over_13">
Steven Parker168,137 Points
For some input types, it looks better to place the label before the control. For radio buttons, it's often preferable to have the label after the control.
I don't think this would fall under "best practice", it's really more about what kind of look you want the form to have.
Not separating the elements also affects how they are shown on the page. That keeps the browser from moving the label further away from the control.
The class assignment is unrelated to the element order, it's just there to facilitate styling (and/or scripting). What ties a label with an input is the "for" property of the label matching with the "id" property of the input.