Parent li keep color when on child list item

I am having trouble editing my themes navigation menu. I am using the Avada WordPress theme. Here is the site I am working on http://192.185.2.154/~sogo/tempsourceoneevents.com/

When I am on a parent level with no sub levels the current-page code works. If you go to Exhibitor Services -) Electrical. The sub li has correct code but the parent loses the background color.

Read More

I am also having a trouble when I am hovering over sub parts of the nav. If I go over “departments and then hover over expo, departments loses the white text. This has to be because I set the a color to the blue.

My CSS I use for the navigation

#wrapper .header-social {
    background-color: #536F9E !important;
}

#nav ul li:hover {
    background-color: #536F9E !important;
}

#wrapper .header-social .menu > li, .mobile-menu-sep {
    border-color: #385077 !important;
}

li.current_page_item, li.current_page_item a {
    background-color: #536F9E !important;
    color: #ffffff !important;
}

#wrapper #nav ul li ul li > a:hover {
    color: #fff;
    background-color: #536F9E !important;
}

#nav ul li ul li {
    border-bottom: 1px solid #F1F1F1;
}

#wrapper .nav-holder li li > a, .top-menu li > a {
    transition: color 0 ease-in-out, border-color .2s ease-in-out;
    -o-transition: color 0 ease-in-out, border-color .2s ease-in-out;
    -moz-transition: color 0 ease-in-out, border-color .2s ease-in-out;
    -webkit-transition: color 0 ease-in-out, border-color .2s ease-in-out;
}

#nav ul li {
    padding: 0 !important;
    border-right: 1px solid #d7d7d7;
}

#nav ul li a {
    padding: 0 13px !important;
}

#nav ul li ul li a {
    padding: 7px 33px !important;
}

#nav ul li:last-child {
    border-right: 0 !important;
}

#nav ul li.last-menu-item {
    padding-right: 13px !important;
}

.header-v4 #header .search {
    margin-top: 15px !important;
}

.header-v4 #small-nav, .header-v5 #small-nav {
    background: rgba(247,247,247,1);
    background: -moz-linear-gradient(top,rgba(247,247,247,1) 0%,rgba(232,232,232,1) 100%);
    background: -webkit-gradient(left top,left bottom,color-stop(0%,rgba(247,247,247,1)),color-stop(100%,rgba(232,232,232,1)));
    background: -webkit-linear-gradient(top,rgba(247,247,247,1) 0%,rgba(232,232,232,1) 100%);
    background: -o-linear-gradient(top,rgba(247,247,247,1) 0%,rgba(232,232,232,1) 100%);
    background: -ms-linear-gradient(top,rgba(247,247,247,1) 0%,rgba(232,232,232,1) 100%);
    background: linear-gradient(to bottom,rgba(247,247,247,1) 0%,rgba(232,232,232,1) 100%);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f7f7f7',endColorstr='#e8e8e8',GradientType=0);
}

#wrapper .page-title h1, .page-title ul li, .page-title ul li a {
    color: #fff !important;
}

Related posts

Leave a Reply

2 comments

  1. WordPress has class for parent page in navigation, so just add .current-menu-ancestor and .current-menu-parent to :hover

        #nav ul li:hover > a, .current-menu-ancestor > a, .current-menu-parent > a {
            background-color: #536f9e !important;
            color: #ffffff !important;
        }
    
  2. you have used this CSS:

    #wrapper #nav ul li ul li > a:hover {
    color: #fff;
    background-color: #536F9E !important;
    

    }

    So when you are hovering on the sub li everything is fine but the color of the text for parent goes back to #536F9E which is same as the background color so text is not visible.
    Try to use a different color for background and text.