Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Underline Effect On Menu Only And Not Drop-down Submenu

  • I previously used the code below I think kindly provided by David in the old forum. I was using it on a menu without drop-down menus and it worked great.

    But now I wanted drop-down menus and the cool red underline does not look good on the drop-down menus.

    How can the code be adapted to not apply to the drop-down menus:

    `@media(min-width: 1024px) {
    .main-navigation .main-nav ul li a {
    position: relative;
    }
    .main-navigation .main-nav ul li a:after {
    content: ”;
    position: absolute;
    bottom: 4px;
    left: 20px;
    right: 20px;
    height: 3px;
    background-color: transparent;
    transition: background-color 0.2s ease;
    }
    .main-navigation .main-nav ul li:hover a:after,
    .main-navigation .main-nav ul li[class*=”current”] a:after {
    background-color: #f00;
    }
    }

  • Hi there,

    Could you provide a link to your site?

  • Hi, as stated, I am not using the code. I can put it on a non critical site for you to look at if you wish.

    But the inspiration came from this site:

    https://www.nngroup.com/

  • Try changing the CSS to this:

    @media (min-width: 1024px) {
        .main-navigation .main-nav > ul > li > a {
            position: relative;
        }
    
        .main-navigation .main-nav > ul > li > a:after {
            content: "";
            position: absolute;
            bottom: 4px;
            left: 20px;
            right: 20px;
            height: 3px;
            background-color: transparent;
            transition: background-color 0.2s ease;
        }
    
        .main-navigation .main-nav > ul > li:hover > a:after,
        .main-navigation .main-nav> ul> li[class*="current"]> a:after {
            background-color: #f00;
        }
    }

    If it doesn’t work, please provide your site link.

    Let me know 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.