Cant seem to get this ID to work

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

<h2>CatPhotoApp</h2>
<main>

<a href="#footer">Jump to Bottom</a>

  <img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back.">

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff. Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched. Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched. Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff. Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
<p>Meowwww loved it, hated it, loved it, hated it yet spill litter box, scratch at owner, destroy all furniture, especially couch or lay on arms while you're using the keyboard. Missing until dinner time toy mouse squeak roll over. With tail in the air lounge in doorway. Man running from cops stops to pet cats, goes to jail.</p>
<p>Intently stare at the same spot poop in the plant pot but kitten is playing with dead mouse. Get video posted to internet for chasing red dot leave fur on owners clothes meow to be let out and mesmerizing birds leave fur on owners clothes or favor packaging over toy so purr for no reason. Meow to be let out play time intently sniff hand run outside as soon as door open yet destroy couch.</p>

</main>

<footer>Copyright Cat Photo App</footer>
<h2 id="footer">footer</h2>
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36

Challenge: Link to Internal Sections of a Page with Anchor Elements

Link to the challenge:

From the challenge…

You then need to add the same id attribute to the element you are linking to. An id is an attribute that uniquely describes an element.

It looks like you’ve added the id to the h2 tag below the footer section.

And it also looks like you closed the footer tag before the h2 tag, so that h2 is technically not part of the footer, it is below it.

So while your code provides similar functionality, it is not precisely following the instructions and what the challenge is looking for.

What your code is doing is, when the link is clicked, it jumps to the h2 below the footer section, not the footer section itself. If it’s not passing the test, that’s why.

Generally, since id's are unique, you assign them to only 1 element, but if you’re just linking to an element with an id, it’s ok to use the id in the anchor, because you are just linking to it, not assigning the id to the anchor tag.

But assigning both the footer and the h2 to the same id, while it may work in this particular case, introduces ambiguity and would be improper usage of id's.

If you wanted to select more than one element, that’s when you’d use a class, which you will be introduced to later, if you haven’t already in previous challenges.

And I should have worded it the other way around to be more precise… you assign an element to the id with the id attribute, you don’t assign the id to the element. But that’s just grammatical semantics. I meant the same thing. (just stating that so that someone else doesn’t feel the need to call me out on that :smiley:)

1 Like

thanks mate much appreciated.