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 trialCAMILO ALMARZA
648 PointsWhat is the difference between class and id ??
When do I want to use class instead of id??
3 Answers
tuukka uosukainen
22,107 PointsYou 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.
David Omar
5,676 PointsId 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
CAMILO ALMARZA
648 PointsThank you!
tuukka uosukainen
22,107 PointsYou are very welcome!
CAMILO ALMARZA
648 PointsCAMILO ALMARZA
648 PointsThank you!!