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

CSS CSS Basics (2014) Basic Selectors CSS Comments

Ezekiel dela Peña
Ezekiel dela Peña
6,231 Points

Question about IDs.

I understand that I can use only one ID per page. But can I use ID from another page?

ex: I use ID = "div-wrapper" from index.html Then I use the ID ="div-wrapper" again from about.html

1 Answer

Mark VonGyer
Mark VonGyer
21,239 Points

Yes!.

You can use the same ID across multiple pages, but only once per each page.

Rafael Valera
Rafael Valera
8,401 Points

But what if you want to be specific when applying different CSS rules to the index.html or about.html page in the CSS file???

Mark VonGyer
Mark VonGyer
21,239 Points

Use a different ID and use a class for the common CSS rules.

Ezekiel dela Peña
Ezekiel dela Peña
6,231 Points

Then you'll need to give it another ID for that.