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 trialkartikashree
3,383 PointsConfused about use of "ID" multiple times on a single html page on 'How to make a website'
There's #wrapper, #logo, #gallery on the same html page. Is this meant only for learning purposes? I thought "Id" could only be used once, the rest being 'classes'.
kartikashree
3,383 PointsThank you, Jeff! I think I get it now.
2 Answers
Arthur Verschaeve
20,816 PointsWhat they do is correct. Here, you use more than one id's: wrapper, logo, gallery;
What they mean by "'Id' could only be used once, the rest being 'classes'" is that you can't have two elements with the same id.
kartikashree
3,383 PointsThank you, Arthur!
Jeff Busch
19,287 PointsJeff Busch
19,287 PointsHi Kartikashree,
You can have as many ids as you want on a page but you can only use a specific id once. For example; id="logo" can only be used once on a page. You could also use id="gallery" on the same page but it can be used only once on that page. On the other hand class="someClass" could be used multiple times on a page.
Jeff