Jump to content

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

Recommended Posts

Posted (edited)

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
  • Replies 4
  • Views 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

Posted
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 (Pinch/Zoom images, videos - PDFs Lightbox - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> 🤖 Ask me anything

Posted
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!)

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.