Cat App step 56 question

Hey lauren, if you want to learn the why behind why we use labels, I’ve already created a post and I would recommend reading that first.

As for the two ways you can associate an input with a label.

  1. Just “nest” (put inside) the input element that you want to add a label to, inside of a label element. Example:
<label> name <input /> </label>
  1. The second way is to use the label element’s for tag. Just use an input element’s id as the value for the label’s for attribute. Example:
<label for="name">Name</label>
<Input id="name" />

if you click on a label beside an input and the input gets “triggered” (you can type into it even if you haven’t directly clicked on the input yet) then that means that label is connected to that input.

Feel free to ask any more questions you might have.

Hope this helps :smile:

5 Likes