this is becoming a habit…objective: " 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
“hint”: “The new label element does not have a “for” attribute. Check that there is a space after the opening tag’s name.”
i’m about positive i did this correctly so i’m confused as to why i’m stuck…
**Your code so far**
<!-- 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>
<h3>Things cats love:</h3>
<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>
<h3>Top 3 things cats hate:</h3>
<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>
<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>
<input id="loving" type="checkbox"> <label> for='loving' </label>
<input type="text" name="catphotourl" placeholder="cat photo URL" required>
**Your browser information:**
User Agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/18.104.22.168 Safari/537.36
Challenge: Step 55
Link to the challenge:
You did not add a
for attribute to the
Here you set the
type attributes of the
If you don’t remember what an attribute is, you can review here:
the “for” attribute is inside the “label” element as instructed to the right of the input element…so i guess what im missing is why the for attribute wont take like the id and type attributes before it…
No, you do not have a
for attribute inside of your
label element. You have the text
for='loving' between the opening and closing
label tags, but that is not how you add an attribute. The attribute must be inside of the opening
You have 25 correctly set attributes in your code so far. This one you’re currently trying to add looks different than the previous 25 you’ve written.
Right here, for example, you have the
type attributes inside of your
input element. If I swapped it to the syntax you’re trying to use for the
label it would look like:
<input> id="loving" type="checkbox"
The attribute has to be inside of the opening tag for the element.
ok i see what you’re saying but if i do it that way it just tells me that the lebel element requires an opening and a closing tag…so closing tag doesnt change but you’re saying i have to change the opening tag to include the attribute?
What is your code with this fix?
Yeah, you need to add the
for attribute to the opening
<label for='loving'> </label>
thats what it would look like if i did it the way you just described…
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (
</>) to add backticks around text.
See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').
Now you need to add this part. Right now you have no text between the opening and closing tags.
i got it now but it is different from past attributes the past labels used the attributes did not require closing tags labels do which is why confused me i guess. appreciate the help
The attributes don’t have anything to do with closing tags.
HTML attributes are special words used inside the opening tag of an element to control the element’s behavior.