maniacalmorgan Posted February 14 Share Posted February 14 (edited) Hi all, Having some issues getting the nav bar working the way I'd like. Currently works when you hover over a folder that's non active, but when you hover over an active folder, there's an underline under each link and then the default underline is back for the active page. I'm trying to get the focused page be underlined along with the folder... not every page under the folder. Hope that makes sense! Here's the site: https://www.morganmerrill.co Here's the code I'm using: /* change header nav active style */ .header-nav-item--active a { background-image: none !important; } /* Change the underline color of the top menu links */ .header-nav-item a { position: relative; text-decoration: none !important; color: #00ff2a; /* Set the color of the link */ } .header-nav-item a::after { content: ""; position: absolute; left: 0; bottom: -2px; /* Adjust the positioning of the underline */ width: 100%; height: 2px; /* Adjust the height of the underline */ background-color: #00ff2a; /* Set the color of the underline */ visibility: hidden; opacity: 0; transition: opacity 0.4s; } .header-nav-item a:hover::after, .header-nav-item a:focus::after, .header-nav-item--active a::after { visibility: visible; opacity: 1; } /* Optional: Change the underline color when the link is active or focused */ .header-nav-item--active a::after { background-color: #00ff2a; /* Set the color of the underline when the link is active */ } div.header-nav-item a { display: inline-block; } Thanks! Edited February 14 by maniacalmorgan Link to comment
tuanphan Posted February 17 Share Posted February 17 div.header-nav-item a will affects both main item + dropdown items but div.header-nav-item>a will affect main item only, it won't affect dropdown items You can base on this to adjust all the code above Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment