Grow your CSS skills. Land your dream job.

[wordpress] parent menu highlight when in sub-menu page

  • # June 29, 2013 at 12:22 pm

    Hi,

    I’m trying to get a child page to highlight it’s parent in a main menu. The link is below.
    What I’m trying to achieve is when you click on the parent menu link it goes straight to it’s sub-menu option 1. If you then go to sub-menu option 2, the parent link should still be highlighted.

    I’ve tried using

    .current-page-ancestor a {
    color: black;
    }

    with no luck.

    http://tinyurl.com/o22cyep

    Hopefully this makes sense. Does anyone know how I can achieve this?

    Thanks in advance.

    # June 29, 2013 at 1:27 pm

    In your css you have

    .menu a {bunch of styles}

    Add this

    .menu a.active, .menu a.active:hover {
    color:#000;
    }

    Add

    class=”active”

    to your anchor on every page you want your text in parent navigation to be black

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".