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

HTML How to Make a Website Adding Pages to a Website Add Iconography

Matic Kravanja
Matic Kravanja
2,759 Points

Why do we have to use multiple classes and elements when styling contact info?

So I'm slightly confused why we have to use: .contact-info li.phone a when styling contact info? Why couldn't I just use the .phone class or li.phone a, why is the .contact-info class necessary? Is it just to better specify what we're trying to style?

Thanks!

1 Answer

Steven Parker
Steven Parker
229,787 Points

It's not necessary to be this specific.

In fact, if the phone class is not used elsewhere, this can just be ".phone a". It cannot be simply ".phone" because that would target the li element instead of the a element.

My guess is using it in the video is just an example of how to construct selectors with high specificity, or a precaution for possible future use of the phone class elsewhere.

Matic Kravanja
Matic Kravanja
2,759 Points

Oh okay, that's what I was thinking but didn't hear it being mentioned anywhere so I wanted to make sure. Appreciate your help.