Home>Support>How to change main navigation text and hover colors for separate items?

How to change main navigation text and hover colors for separate items?

Hi,
I am trying to change main navigation text and hover colors for separate items but so far nothing worked. Could you provide a CSS for that? Thanks!

URL: http://clubemprendimiento.com/

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 7 years, 9 months ago Andrew Misplon Hi, I Work Here

    Hi Mindaugas

    Are you able to use your browser’s developer tool to inspect the page source? Here is how:
    https://siteorigin.com/basics/modifying-theme-design-with-custom-css/

    Insert the following under Appearance > Custom CSS:

    /* Menu */
    
    .main-navigation ul li.menu-item-223 a {
    background: #000;
    color: red;
    }
    .main-navigation ul li.menu-item-223:hover > a {
    background: #fff;
    color: blue;
    }
    
    .main-navigation ul li.menu-item-33 a {
    background: #000;
    color: red;
    }
    .main-navigation ul li.menu-item-33:hover > a {
    background: #fff;
    color: blue;
    }
    
    .main-navigation ul li.menu-item-35 a {
    background: #000;
    color: red;
    }
    .main-navigation ul li.menu-item-35:hover > a {
    background: #fff;
    color: blue;
    }
    
    .main-navigation ul li.menu-item-215 a {
    background: #000;
    color: red;
    }
    .main-navigation ul li.menu-item-215:hover > a {
    background: #fff;
    color: blue;
    }
    

    Edit as required.

    If you inspect the menu source you’ll see the list item class I’m targeting for each item.

  2. 7 years, 9 months ago Mindaugas Vaičiūnas

    That worked perfect. Thanks!
    What about if I want to add a background image to one of the menu buttons?

  3. 7 years, 9 months ago Andrew Misplon Hi, I Work Here

    For menu icons you can use our built in theme feature or the following plugin that has several icon libraries:

    https://wordpress.org/plugins/menu-icons/

    For a background image, let me know which menu item you want that on and we’ll try help out.

  4. 7 years, 9 months ago Andrew Misplon Hi, I Work Here

    If you take a look at this thread here:

    Thread: Highlight Single Menu Item

    I’ve applied a different background color and hover color to a single menu item. I did that by inspecting the page source and finding the class of the list item (li) of the menu item that I wanted to target. It would be exactly the same except we’d add in a background image property:

    /* Menu */
    
    .main-navigation ul li.menu-item-358 a {
    background: #000 url("http://imageurl.com") no-repeat;
    color: red;
    }
    
    .main-navigation ul li.menu-item-358:hover > a {
    background: #000 url("http://imageurl.com") no-repeat;
    color: blue;
    }
    

    So you’d need to replace 358 with the menu item class number and replace http://imageurl.com with your image url and replace my background and text colors with yours.

  5. 7 years, 9 months ago Mindaugas Vaičiūnas

    I want to change the background of this item: .main-navigation ul li.menu-item-215 a. Thanks

  6. 7 years, 9 months ago Andrew Misplon Hi, I Work Here

    That’ll look something like this:

    /* Menu */
    
    .main-navigation ul li.menu-item-215 a {
    background: #000 url("http://imageurl.com") no-repeat;
    color: red;
    }
    
    .main-navigation ul li.menu-item-215:hover > a {
    background: #000 url("http://imageurl.com") no-repeat;
    color: blue;
    }
    
  7. 6 years, 9 months ago MJ

    To extend this conversation further, however late to the game…can this CSS be applied to one specific page? I tried utilizing the above CSS with each menu item preceded by .page-id-xx

    Example page:
    http://imsone.com/gradrun/kids/
    I want to alter the hover color and secondary (dropdown) menu color background and text to match the color theme of main menu bar color on just this page.

    You can see the homepage and the rest of the site is has a different color theme –
    http://imsone.com/gradrun/

    Thanks!

  8. 6 years, 9 months ago Andrew Misplon Hi, I Work Here

    Definitely. Everything will be prefixed with the page body class. In the case of your example it would be:

    page-id-676

    It looks like you’ve made good progress. Let me know where you stand now and we’ll take it from there :)

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More