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 Adding Pages to a Website Build the Contact Page

Why does Nick use "class" for items which appear just once?

One says "use ID if you only ever use one of these elements, use class if there's more than one instance of it".

But I got confused over this stage in particular because Nick uses class for all these list items on the contact page (phone, email). Why is that? They just appear once on that very page...

Are there other reasons to use class over id?

1 Answer

Wayne Priestley
Wayne Priestley
19,579 Points

Hi Katsumi,

An ID has more specificity than a Class, so really you should use it rather than a class if its appropriate, but its mostly down to what you prefer.
Unless you think that you may need to use that specific styling elsewhere in you code in the future. If thats the case then using a class will result in less code being written.

Hope this helps.