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

CSS CSS Layout Techniques Display Modes Table Display

John Marshall
John Marshall
3,475 Points

".main-nav" and ".main nav li"? Aren't they the same?

This may be a stupid question but I'm just trying to understand the difference between the two.

Only using ".main-nav" would style every thing inside the main-nav element. By using ".main-nav li" you're targeting just the " li " inside the main nav element.

You might only have " li " inside the "main-nav" right now or for a lesson, but if in the future you ever have a "main-nav" with a bunch of stuff in it including " li " tags and you want to use a certain style on only those tags, you'd need to style it that way

1 Answer

John,

If your using Firefox or chrome, they have great dev tools to help let you understand this in the real world.

Right click on your navigation and click inspect element. Then as you go through your code you will be able to see what each class or element is selecting.

Another trick is to change the background color to an obviously different color to see what is being selected.

Joe