How to add an id attribute to the value of the footer

Hi, I just started this coding course today and im stuck on adding the id attribute to a footer. The lesson says to set the value of an id tag to footer. I have no clue what this means any advice?

can you link to the challenge please?

Sure

An id is an attribute with in an element, similar to class:

<p class="class_name"></p>

You can do the same thing with id.

After that you can style or link to a specific element based on that id.

You need to add an id attribute to the <footer> tag and then in your <a> tag, you need to change the href attribute to the same thing as what you set the id to in the <footer> tag

Is there a video I can watch? I still dont get it

I don’t know of a video of the top of my head but I can give an example.

Say we want to link an anchor tag to another part of the page. We need to tell it were to go to. To do this we give an element an id which is unique to only it. Say we have:

<h1 id="important_part"> An important Part </h1>

Here we gave the <h1> element an id of “important_part”. Now we can use that to link to it. Next we create an anchor, and have it’s src set to that id:

<a href="#important_part> Jump to the Important Part </a>

Now when we click the link it will take us to that <h1> element. Note that we used a hashtag/pound sign in the href? This tells it we are using an id.

Here’s the documentation on the id attribute:

EDIT:

Sorry, I said src… I meant href. :sweat_smile:

1 Like

Click the “Get Help” button then click “Watch a Video” (or use this link Link to Internal Sections of a Page with Anchor Elements)


Look at the example code:

<a href="#contacts-header">Contacts</a>

<h2 id="contacts-header">Contacts</h2>

Here the link is “connected” to the <h2> element. You need your link to be “connected” to the <footer> (using the correct id and href).

Ok I actually found my mistake I had the “>” symbol where it wasnt need -__-
thank you guys for your help!

1 Like

Just for future reference.

If you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge. It will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

1 Like