Question about <label> and <input>

Early in the course, you learn about making a label and then making an input, and then connecting them through for and id.

Then, I noticed that the lessons began nesting inputs in the labels. I got to scratching my head about it, so I did a bit of research, and it seems like the lessons are teaching a mix of implicit and explicit methods for inputs and labels.

My question, then, is which should I use? Even the first project tells you to use id and for, so i assume explicit is the road they expect me to take, but the lessons actually mix the two methods.

You can use either, but you should always include the for attribute.

1 Like

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