App Academy

Example Question - HTML Labels & Inputs

Learning Challenge: HTML/CSS

Question: How do you link a label to an input? The label and the input both say “name” but they don’t seem to be linked up.

What I’ve tried: I’ve made both the label and the input say “Name”. I’m not really sure what to search for on Google…

Screen shots:

1 Like

You want the element’s for attribute to equal the id of the input, like so:

>  <div>
>    <label for="lastName">Last name</label>
>    <input type="text" id="lastName" name="last_name">
>  </div>