Nesting Loving label in Cat Photo App - Step 55

Here’s the challenge:

# Step 55

There’s another way to associate an input element’s text with the element itself. You can nest the text within a label element and add a for attribute with the same value as the input element’s id attribute.

Associate the text Loving with the checkbox by only nesting the text Loving in a label element and place it to the right side of the checkbox input element.

Oh boy, I have spent the last 2 hours trying different combinations of html for this one. This is my latest attempt and I still can’t figure it out! I’ve even restarted my computer in case I’ve got a glitch.

Here is my latest rejection Hint:

The text Loving should no longer be located directly to the right of your checkbox. It should be wrapped in a label element. Make sure there is a space between the two elements.

I know lots of others have been stuck on this one, and I’ve tried the answers to all of them but I’m still getting it wrong. I’d appreciate some really clear guidance here, thanks so much.

  **Your code so far**
      <h2>Cat Photos</h2>
      <!-- TODO: Add link to cat photos -->
      <p>Click here to view more <a target="_blank" href="">cat photos</a>.</p>
      <a href=""><img src="" alt="A cute orange cat lying on its back."></a>
      <h2>Cat Lists</h2>
      <h3>Things cats love:</h3>
        <li>cat nip</li>
        <li>laser pointers</li>
        <img src="" alt="A slice of lasagna on a plate.">
        <figcaption>Cats <em>love</em> lasagna.</figcaption>  
      <h3>Top 3 things cats hate:</h3>
        <li>flea treatment</li>
        <li>other cats</li>
        <img src="" alt="Five cats looking around a field.">
        <figcaption>Cats <strong>hate</strong> other cats.</figcaption>  
      <h2>Cat Form</h2>
      <form action="">
          <legend>Is your cat an indoor or outdoor cat?</legend>
          <label><input id="indoor" type="radio" name="indoor-outdoor" value="indoor"> Indoor</label>
          <label><input id="outdoor" type="radio" name="indoor-outdoor" value="outdoor"> Outdoor</label>
          <legend>What's your cat's personality?</legend>
             <label><input id="loving"type="checkbox"></label>
         <input id="Loving" type="checkbox"> <label for="Loving"></label>
        <input type="text" name="catphotourl" placeholder="cat photo URL" required>
        <button type="submit">Submit</button>
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:103.0) Gecko/20100101 Firefox/103.0

Challenge: Learn HTML by Building a Cat Photo App - Step 55

Link to the challenge:


The original code for the checkbox input element was
<input id="loving" type="checkbox">

It looks as though you’ve changed the id attribute on that element - but the instructions didn’t ask you to do that.
So, the first thing I would do is to correct that id attribute.

Once you have the correct id attribute, you need to make sure that the for attribute on the label element exactly matches the id attribute on the corresponding input element.

Finally you need to add the label text, as specified in the challenge instructions.
Remember that the text of a html element goes between the element’s opening and closing tags.

1 Like

Thanks so much KittyMac, I’ll get on to it.

You are a legend. Your instructions were spot on! Thank you thank you!! :star_struck: