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

Michael Greig
Front End Web Development Techdegree Student 10,328 PointsWhy would we not use an ID for the title rather than the .title class?
Is it because we might want to re-use the .title class on another page?

Michael Greig
Front End Web Development Techdegree Student 10,328 PointsThanks Jesse that's really helpful! Thought that was probably the case
1 Answer

Steven Parker
243,121 PointsThere are a couple of possible reasons.
Jesse's partly right in that using a class allows the style to be reused on other elements on the same page. An ID must be unique on each page, but it can still be reused (once each) on other pages.
Another reason has to do with CSS precedence rules based on specificity. And ID selector takes precedence over a class selector no matter where it occurs in the cascade, and this behavior might not be desired.
Jesse Kroon
8,275 PointsJesse Kroon
8,275 PointsMichael,
You've practically answered your question yourself. Say you want to create another page and want to use the exact same styling to a certain element. If you use a id selector, you would have to create a new one with a different name, copy and paste the CSS code from the other id. This is because id's are unique, meaning you can only use them once in your code. Using a class selector would make it much easier to just apply the same styles to multiple elements.
Hope this makes things more clear for you. If not, let us know!