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
Richard Targett
4,960 PointsTags and ID's
Can someone explain to me the fundamentals of ID's and CLASS's?
When to use one, and when not to?
2 Answers
Edwin Billa
Courses Plus Student 6,882 PointsHello Richard. IDs are used when you want to apply the styling to only one element. you can use the same id just once in a document. whiles the same Class can be used on multiply element on the same document. Again IDs have more specificity than classes. i hope this helps :)
Terrance Corley
11,990 PointsHi Richard!
Edwin has the right idea. HTML elements can have multiple classes but may only have one ID. In fact there can only be one instance of an ID per web page. To read a little more in depth about it feel free to check out this article. https://css-tricks.com/the-difference-between-id-and-class/