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

HTML How to Make a Website Adding Pages to a Website Build the Contact Page

CAMILO ALMARZA
CAMILO ALMARZA
648 Points

What is the difference between class and id ??

When do I want to use class instead of id??

3 Answers

You can use only one id / page. For example #logo can be used only once, but same .class can be applied to many elements. You can use different id’s like #footer, #mainDiv on a page though. A little hard to explain. Hope this helps.

http://css-tricks.com/the-difference-between-id-and-class/

David Omar
David Omar
5,676 Points

Id is unique to one page while class can be used on more than one element. Use class when you want to reuse style to multiple elements

You are very welcome!