Using CSS to style the navigation

In our CSS, first we'll find the big block comment for the navigation:

/****************nav****************/

We'll then target the primary-nav. class. Let's use a special type of descendant selector that only targets the first level of list items:

.primary-nav > li

This is important. We're doing this because later we'll nest another unordered list within these list items to get a drop-down menu. Let's say we create the same selector without the greater than symbol:

.primary-nav li

This targets any and every li tag inside of primary-nav--children, grandchildren, great-grandchildren, and so on. If you only want to target immediate children, use this selector; it is known as the child combinator:

.primary-nav ...

Get Mastering CSS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.