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 trialKorrea Johnston
110 PointsWhat's the difference between assigning an "id" versus a "class"?
They seem to both be types of alt tags.
2 Answers
Sam Gord
14,084 Pointsadding to what Dave said above, i have to say that there are priorities in styling elements with id or class. id has higher priority than class, means that if u style an element using its id, it will be override the style u give that element using its class .
Dave StSomeWhere
19,870 PointsThe key difference is that an id is unique (can be assigned to only one element) on the page, while many elements can be assigned the same class.
Also, elements can only have 1 id, while they can have many classes.
Korrea Johnston
110 PointsThank you!
Jonathan Fernandes
Courses Plus Student 22,784 PointsJonathan Fernandes
Courses Plus Student 22,784 PointsYou all nailed it!
Korrea Johnston
110 PointsKorrea Johnston
110 PointsThis was very helpful. Thank you!