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**
<html>
<body>
  <h1>CatPhotoApp</h1>
  <main>
    <section>
      <h2>Cat Photos</h2>
      <!-- TODO: Add link to cat photos -->
      <p>Click here to view more <a target="_blank" href="https://freecatphotoapp.com">cat photos</a>.</p>
      <a href="https://freecatphotoapp.com"><img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>
    </section>
    <section>
      <h2>Cat Lists</h2>
      <h3>Things cats love:</h3>
      <ul>
        <li>cat nip</li>
        <li>laser pointers</li>
        <li>lasagna</li>
      </ul>
      <figure>
        <img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/lasagna.jpg" alt="A slice of lasagna on a plate.">
        <figcaption>Cats <em>love</em> lasagna.</figcaption>  
      </figure>
      <h3>Top 3 things cats hate:</h3>
      <ol>
        <li>flea treatment</li>
        <li>thunder</li>
        <li>other cats</li>
      </ol>
      <figure>
        <img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/cats.jpg" alt="Five cats looking around a field.">
        <figcaption>Cats <strong>hate</strong> other cats.</figcaption>  
      </figure>
    </section>
    <section>
      <h2>Cat Form</h2>
      <form action="https://freecatphotoapp.com/submit-cat-photo">
        <fieldset>
          <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>
        </fieldset>
        <fieldset>
          <legend>What's your cat's personality?</legend>
             <label><input id="loving"type="checkbox"></label>
         <input id="Loving" type="checkbox"> <label for="Loving"></label>
        </fieldset>
        <input type="text" name="catphotourl" placeholder="cat photo URL" required>
        <button type="submit">Submit</button>
      </form>
    </section>
  </main>
</body>
</html>
  **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:

Hi

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:

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