WordPress.org

Forums

Please Help, Been looking for a solution for weeks. current-menu-item issue (4 posts)

  1. eric brockman
    Member
    Posted 3 years ago #

    I've been posting about this for weeks and for whatever reason no one seems to know what the issue is, I'm dying for a fix...

    When I add a style attribute to a the .current-menu-item that is in a drop down it effects the whole drop down list, not just the current menu item.

    Here's a link to site: ericbrockmanwebsites.com/dev4 (still very much a work in progress)

    Here's the CSS

    #nav {
        display: block;
        margin-left: 575px;
        position: absolute;
        top: 78px;
        width: 400px;
    }
    
    #nav .menu, #nav .menu ul {
        list-style: none;
    }
    
    #nav .menu li {
        float: left;
    }
    
    #nav .menu a {
        float: left;
        display: block;
        color: #999;
        padding: 9px 10px;
        text-decoration: none;
        font-size: 14px;
        font-family: Helvetica, Arial, sans-serif;
    }
    
    #nav .menu a:hover {
        color: #ccc;
    }
    
    /* Styling for current parent item */
    #nav .menu li.current-menu-item a, #nav .menu li.current-menu-parent a {
    opacity: 0.5;
    }
    
    /* Styling for sub-menus */
    
    #nav .menu li ul {
        position: absolute;
        width: 100px;
        left: -999em;
        margin-top:30px;
        padding-top:15px;
    }
    
    #nav .menu li ul li a {
        font-size: 11px;
        color: #999;
        width: 100px;
        border-bottom: 1px solid #ccc;
        text-transform: none;
    }
    
    #nav .menu li.current-menu-item ul li a {
    display: block;
    }
    
    #nav .menu li ul li a:hover {
        color:#ccc;
    }
    
    #nav .menu li:hover ul, #nav .menu li li:hover ul, #nav .menu li.sfhover ul, #nav .menu li li.sfhover ul {
    	left: auto;
    }

    Thanks in advance for any help!!

  2. RichardWPG
    Member
    Posted 3 years ago #

    I think it'll be easier for you to create a menu using a plugin then.

  3. eric brockman
    Member
    Posted 3 years ago #

    Thanks Richard, perhaps I should look into that, but it seems counter-intuitive. Surly there must be a way to style the parent menu item without having it style the whole drop-down list. I can't be the first person who's wanted to apply a style attribute to a current menu item in a drop-down.

  4. John Sundberg
    Member
    Posted 2 years ago #

    Hey Eric,

    Don't know if you found the solution to your "current-menu-item in a drop-down menu" question yet, but I think the CSS selector you were looking for is:

    #nav .menu li ul li.current-menu-item a

    I was wrestling with a similar problem this evening and stumbled across your post.

    John

Topic Closed

This topic has been closed to new replies.

About this Topic