Jump to content

Nav Bar Underline Color for Focus & Hover

Recommended Posts

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 by maniacalmorgan
Link to comment
  • Replies 1
  • Views 1.2k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.