Just cant change the colour of the first li item :-(

Hi from sunny York and for once not raining York UK :slight_smile:

Ive got my self in a total twist trying to change just the colour of the first li items for my footer navigation. Put another way on this page http://www.davidclick.com there is a footer nav. I want just the first li items to be a different colour, so when you hover over examples, examples is orange but its sub nav stays as its is, but I just cant do it.

Here is my problem illustrated:

Do it like this:

.navigation > li:hover >a{color:orange}

The child selector keeps the context to immediate children so that nested lists aren’t affected. We use the li:hover rather than a:hover so that the word ‘examples’ stays orange while you travel up and down the subnav.

2 Likes

Yes thank you you fixed it. Ive read about child combinators here:
https://css-tricks.com/child-and-sibling-selectors/ and understand better now :slight_smile:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.