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 trialRyan Maneo
4,342 PointsWhy is social-icon and profile-picture a class and not an id?
Couldn't an ID work just fine for this since they're static (and you aren't adding a function to it like the navbar which has a selected class)
1 Answer
Steven Snary
17,540 PointsThe general answer is that Classes should be used when you want to apply a style to more than one element - so let's say you want the same style for a Facebook, Twitter and Linkedin svg or image. You would give them all the class of social-icon.
ID's are only to be used if you will be applying the class to one specific element - you should never give an ID to more than one element.