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

targeting classes

does it makes any difference if we target the class like this.

.phone a {}

instead of targeting the class like in the video,

.contact-info li.phone a {}

is there any difference in targeting it with .phone a {}?

1 Answer

Adam Pengh
Adam Pengh
29,881 Points

The only difference is that the selector is more specific. For example, let's say you have an <li> element in the header with class .phone and a link inside, and the same thing in the footer. Using ".phone a" would select any link with a parent that has class .phone, but adding the .contact-info before would only select a "li.phone a" with a parent of ".contact-info".

thank you so much !