Jump to content

Underline on nav menu item extends beyond text. How can I fix this?

Recommended Posts

Hey all,

So I have added an underline to the active nav bar item using the follow code -

.Header-nav-item--active {
    border-bottom: 1.5px
      solid #a96628;
}

The result is almost right, however the line overshoots the text slightly. This seems to be because the text has some kind of padding to the right and so the underline extends all the way to there ( see images below). Any ideas how I might eliminate this so that the underline is exactly the same width as the text? (This is using a Brine template in 7.0)

image.thumb.jpeg.87d95abe5cac3d6cc9a0e7e3526cba68.jpeg

image.thumb.jpeg.afbededdf73f4e3a5ddd51c60c97fad4.jpeg

 

Thanks in advance!

Edited by vincentlefre
Link to comment
  • Replies 4
  • Views 815
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

2 hours ago, vincentlefre said:

Hey all,

So I have added an underline to the active nav bar item using the follow code -

.Header-nav-item--active {
    border-bottom: 1.5px
      solid #a96628;
}

The result is almost right, however the line overshoots the text slightly. This seems to be because the text has some kind of padding to the right and so the underline extends all the way to there ( see images below). Any ideas how I might eliminate this so that the underline is exactly the same width as the text? (This is using a Brine template in 7.0)

image.thumb.jpeg.87d95abe5cac3d6cc9a0e7e3526cba68.jpeg

image.thumb.jpeg.afbededdf73f4e3a5ddd51c60c97fad4.jpeg

 

Thanks in advance!

Can you share your site with the protected password so we can take a look at it?

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
On 8/1/2022 at 10:00 PM, vincentlefre said:

Sure -

https://adrisenergy.squarespace.com/

Password - 1234

You can use this new code to add underline on active items

a.Header-nav-item.Header-nav-item--active:after {
    content: "";
    background-color: #a96628;
    position: absolute;
    left: 0;
    width: 90%;
    bottom: 0;
    height: 1.5px;
}
a.Header-nav-item.Header-nav-item--active {
    position: relative;
}

 

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

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.