HTML HTML Forms Choosing Options Create Checkboxes

add labels for the two checkboxes that say "Fast Shipping" and "Subscribe to Newsletter".

then add line breaks after the labels

index.html
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>HTML Forms</title>
  </head>
  <body>
    <form action="index.html" method="post">
      <h1>Shirt Order Form</h1>
      <label for="color">Shirt Color:</label>
      <select id="color" name="shirt_color">
        <option value="red">Red</option>
        <option value="yellow">Yellow</option>
        <option value="purple">Purple</option>
        <option value="blue">Blue</option>
        <option value="green">Green</option>
        <option value="orange">Orange</option>
      </select>
      <label>Shirt Size:</label>
      <input type="radio" id="small" value="small" name="shirt_size"><label for="small">Small</label><br>
      <input type="radio" id="medium" value="medium" name="shirt_size"><label for="medium">Medium</label><br>
      <input type="radio" id="large" value="large" name="shirt_size"><label for="large">Large</label><br>

   <input type="checkbox" id="shipping" value="fast_shipping"
      name="user_shirt size"><label class="light" for="fast shipping">Fast Shipping</label><br>
      <input type="checkbox" id="newsletter" value="subscribe"
      name="user_shirt size"><label class="light" for="subscribe">Subscribe to Newsletter</label><br>










      <button type="submit">Place Order</button>
    </form>
  </body>
</html>

    HTML
    HTML Forms
    Choosing Options
    Create Checkboxes





      <button type="submit">Place Order</button>
    </form>
  </body>
</html>

2 Answers

Alex Heil
Alex Heil
46,280 Points

hey Angeline Melody Nyatsine , you're actually pretty close already ;) you added in 2 labels but unfortunately you haven't "connected" them right now. remember if you want to add a label to an element the for attribute is the part that targets the id of the one we want to assign it to.

so when you add the label for "fast shipping" you have to identify the id of the fast shipping input. so instead of the value (fast_shipping) you used now the id would be shipping so the label at the end would be

<label for = "shipping">Fast Shipping</label><br>

then we would go the same way for the second label that targets the newsletter. what's the id of the input that's responsible for the newsletter? the id is newsletter . so let's use it for the second label

<label for = "newsletter">Subscribe to Newsletter</label><br>

and that's it. both labels are now associated with their fields. hope that helps and have a nice day ;)

Hi! The for value in label needs to match the id of the target input, so instead of:

<input type="checkbox" id="shipping" value="fast_shipping" name="user_shirt size"> <label class="light" for="fast shipping">Fast Shipping</label><br>

it should be:

<input type="checkbox" id="shipping" value="fast_shipping" name="user_shirt size"> <label class="light" for="shipping">Fast Shipping</label><br>

Note there is a difference in for value in label. Hope that helps!