Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

marcos rodriguez
marcos rodriguez
1,214 Points

He says you can only use one ID element per page but how did he use 3? Is he referring to the title of the ID element?

<header id="top"><a href="#top">

<div id="primary-content">

<footer id="main-footer">

So, I can have multiple id's just not with the same name right? Example: Is OK on one page?

<div id="primary-content">

<footer id="main-footer">

And this is a NOT OK on one page?

<div id="primary-content">

<div id="primary-content">

1 Answer

Steven Parker
Steven Parker
231,269 Points

You are exactly right, as many elements as you want can have an ID, but the rule is that all the names must be different.

So it's not that only one element can have an ID, but that any specific ID name can be given to only one element.

Steven Parker
Steven Parker
231,269 Points

marcos rodriguez — Glad to help. You can mark a question solved by choosing a "best answer".
And happy coding!