I prefer how the input button looked when it went before the input text but, in order to pass a part of the first lesson, you’re prompted to put the input within the labels. My question is, what if I put the input outside and before the labels rather than within the label code? would the code still work in real-world application? or is it strictly like this?
using a for attribute on the label that matches the id attribute on the input make so that the two elements are linked and in this way you have more freedom in styling and layout, and what order you put them, but clicking the label will still bring focus to the input element, and it is accessible.
Note though that even having the input wrapped inside the label you can have both the following ones:
<!-- label text after input -->
<label for="sunny"><input id="sunny" value="sunny" type="radio"> Sunny</label>
<!-- label text before input -->
<label for="sunny">Sunny <input id="sunny" value="sunny" type="radio"></label>