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 Styling Web Pages and Navigation Build Navigation with Unordered Lists

Laksakan Krishnapillai
Laksakan Krishnapillai
6,390 Points

Navigation CSS doubt

The navigation for the links has the css in the format : nav ul {

}

nav li {

}

There is no link to the ul before the li is written. Why is the CSS not written like this:

nav ul li {

}

Any ideas? However I've written it this way and the code works.

1 Answer

Kevin Dumitrascu-Ungar
PLUS
Kevin Dumitrascu-Ungar
Courses Plus Student 995 Points

Hi,

You need to be more specific on what you want to select in CSS. Using nav you refer to the HTML5 nav element that surrounds the menu. Using nav ul you refer to the unordered list that is inside of navigation. Using nav ul li you refer to the list item that is inside of unordered list, that is inside of navigation.

Here is an example that I made.

If you use nav ul li you can not make the red border around unordered list. (Example)

I hope that is usefull.