CSS won’t change colour

Bought a template, and been working on this for the last couple of days. On my wits end now. I am trying to change the hover over main nav colour and current chosen page colour, to no avail. Please advice?

Code attached.

nav#main-nav {
    z-index: 50;
    display: block;
}

nav#main-nav ul {
    position: relative;
    z-index: 49;
    margin: 0;
    padding: 0;
    list-style: none;
}

nav#main-nav ul li {
    position: relative;
    z-index: 45;
    float: left;
    margin: 0 0 0 20px;
    padding: 0;
}

nav#main-nav > ul > li > a  {
    display: block;
    font-family: Ubuntu; 
    font-size: 13px;
    line-height: 40px;
    color: #ffffff;
    text-decoration: uppercase;
    position: relative;
    z-index: 45;
    padding: 20px 0;
    letter-spacing: 0.1em;
}


nav#main-nav > ul > li:hover {
    z-index: 46;
    color: #ffffff;
}


nav#main-nav > ul > li.current-menu-item, 
nav#main-nav > ul > li.current-menu-ancestor {
    color: #ffffff;
    text-decoration: underline;
}


nav#main-nav ul li .sub-menu {
    position: absolute;
    top: 80px;
    left: 0px;
    width: 200px;
    padding: 0;
    display: none;
    z-index: 47;
} 

nav#main-nav ul .sub-menu li {
    float: none;
    border-top: 1px solid;
    margin: 0;
}

nav#main-nav ul .sub-menu li:first-child {
    border-top: none;
}

nav#main-nav ul .sub-menu li a {
    color: #ffffff;
    font-size: 12px;
    line-height: 20px;
    padding: 10px 20px;
    display: block;
}

nav#main-nav ul .sub-menu li:hover  {
    background-color: #ffffff;
}

nav#main-nav ul .sub-menu li:hover a {
    color: #ffffff;
}

nav#main-nav ul .sub-menu li.current-menu-item > a {
    color: #ffffff;
    text-decoration: underline;
}

nav#main-nav ul li ul li .sub-menu {
    border-top: none;
    position: absolute;
    top: 0px;
    left: 201px;
}

Related posts

Leave a Reply

1 comment

  1. You have

    nav#main-nav > ul > li:hover {
        z-index: 46;
        color: #ffffff;
    }
    

    The problem is that the anchor has other styles that override the code above. Then, use

    nav#main-nav > ul > li:hover { z-index: 46; }
    nav#main-nav > ul > li:hover > a {
        color: #ffffff;
    }