[Resolved] Styling navigation menu

Home Forums Support [Resolved] Styling navigation menu

Home Forums Support Styling navigation menu

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #726970
    Zoran

    Hi,

    I’m trying to achieve this look with the navigation and header:
    Header and menu style

    I’m having trouble adding that top effect on the menu item when it’s current or hovered, as well as that rectangle before the logo.

    Can you provide assistance?

    Kindly,
    Z

    #727004
    Leo
    Staff
    Customer Support

    Hi there,

    I would recommend using this method:
    https://docs.generatepress.com/article/navigation-logo/#navigation-as-header

    Can you do that first and I can provide some CSS?

    Let me know ๐Ÿ™‚

    #727488
    Zoran

    Hi,

    Yes, of course, I have done these steps:

    1.Set your navigation location to Below Header or Above Header in Customize > Layout > Primary Navigation.
    2.Remove your site title/tagline/logo from the header in Customize > Site Identity.
    3.Set your Navigation Logo Position to Sticky + Static.
    4.Set your Sticky Navigation Transition to None.
    5.Then, full remove your header using the CSS below:

    #727600
    Leo
    Staff
    Customer Support

    Try this CSS:

    .main-navigation .main-nav ul li a {
        border-top: 2px solid transparent;
    }
    .main-navigation .main-nav ul li a:hover,
    .main-navigation .main-nav ul li[class*="current-menu-"] > a {
        border-top: 2px solid #11b2ae;
    }
    #727721
    Zoran

    Hi!

    This works, only the border is too big right now, and the whole header is tiny in height:
    Big border

    #727880
    Leo
    Staff
    Customer Support

    Hmm the border is the menu item width plus the padding.

    Can you link me to the example site and I can see how they did it?

    #728491
    Zoran

    The image i gave as an example is just a mockup in PS ๐Ÿ˜

    #728534
    Leo
    Staff
    Customer Support

    Hmm so would it be a fixed length regardless the length of the menu item?

    What about a popular solution like this?
    https://docs.generatepress.com/article/adding-menu-hover-animation/

    #730881
    Zoran

    Hi,

    Sorry for the late response. Yes, the length can be a fixed value!

    #731173
    David
    Staff
    Customer Support

    Hi there,

    the height of the header is defined by the size of the logo or by increasing the line-height of the menu items.

    Whats wrong with the code that Leo provided here it can be easily adjusted for the border to sit at the top of the navigation. Let me know.

    #731755
    Zoran

    Hi, I tried using the code, it did not work.

    #731862
    David
    Staff
    Customer Support

    Can you add the code so i can see what the issue is and provide a fix?

    #731893
    Zoran

    I’ve added it.

    #731918
    David
    Staff
    Customer Support

    Ok so replace it with this, i have commented the lines you need / can edit for colors, thickness and width:

    @media (min-width: 769px) {
        .main-navigation .menu > li > a::after {
            content: "";
            position: absolute;
            right: 0;
            left: 50%;
            top: 0;
            -webkit-transform: translateX(-50%);
            transform: translateX(-50%);
    
            display: block;
            width: 0;
            height: 2px; /* Change thickness of border */
    
            background-color: #1e73be; /* Change Color */
            transition: 0.3s width ease;
        }
        .main-navigation .menu > li.current-menu-item > a::after,
        .main-navigation .menu > li.current-menu-ancestor > a::after,
        .main-navigation .menu > li > a:hover::after {
            width: 50%; /* Change width of border */
        }
    }
    #731924
    Zoran

    Works, and looks awesome now. Thank you!

    Regarding the rectangle on the left of the logo, how would you suggest adding it?

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