Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Dylan Carter
Dylan Carter
4,780 Points

Question about the " .contact-info li.phone " concept

the reason we have to put the li before the .phone (or mail or twitter), is it because it does not start chain?

For example if I wanted to select phone directly, could I just use .phone {xx:yyy;}? or would it still need to be li.phone {yyy.xx;}?

2 Answers

Steven Parker
Steven Parker
216,083 Points

The selector li.phone will target all list items that have the class phone. If you use just .phone as a selector, it will target every item (of any kind) that has the class phone.

Now, whether that makes a difference to your page display will depend on whether there are any other elements with that class. If no other elements have that class, it won't make any difference.

Marco Boretto
Marco Boretto
29,821 Points

it depends if you want specifically add styles to a li element with a class .phone otherwise if you want generally apply the style to all the elements sharing the .phone class just use .phone { xx:yyy}