The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] last-child on css menu help please

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #207727

    Hi All,
    I want to make the last menu item in my nav a different colour (bright green). I achieved it with last-child BUT – it has also changed the last children of dropdowns earlier in the menu. Codepen is here – you will need to hover over it to see the earlier menu items and the bright green “last” items. Live situation can be seen here
    Thank you very much everyone.


    Hi Paulie_D!
    That’s exactly what I have in the code already
    nav ul li:last-child {
    background-color: #3C3;
    BUT it makes all the last children of each menu item also the green, whereas I only want it on the top level line. If you can see the live site you will see exactly what I mean (codepen was misbehaving not sure what i did wrong there!)

    thanks – you have come to my resuce before :)


    Paulie_D, I can’t thank you enough!!! :) I didn’t know about the > and I’m sorry I thought they were the same! I will read the link you kindly sent as well. This has worked a treat and is now fixed thanks to you (and your patience!).

    Thanks so much!!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.