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 How to Make a Website CSS: Cascading Style Sheets Take a Mobile-First Approach

Jeffrey Sararas
Jeffrey Sararas
817 Points

How many different types of elements can you assign an ID to?

I see you can add an ID to an <a> element as well as a <div>. Can you put an ID=name on any type of element and then have your #name {} declarations apply to that?

2 Answers

Ricky Catron
Ricky Catron
13,023 Points

If you are asking if the css is going to be used for multiple elements then you should use a class. If it only applys to one element you should use an ID.

If you are asking if any element can have an ID the answer is yes it is a global atribute.

I was a little unsure of what you were asking so I took my two best guesses and answered both haha. Hope one helps.

Jeffrey Sararas
Jeffrey Sararas
817 Points

Haha I was a little unsure of what I was asking too. Your second answer was what I was curious about, and the first answer is also helpful - the next video is discussing classes. So, thanks for both answers!