Jump to content

Reducing space between navigation and underline

Recommended Posts

Posted

Site URL: https://mandarin-violin-mjw7.squarespace.com

password: elise

Dear squarespace community, 

I have animated underline for my navigation links. However the space between the underline and the link is quite big. How do I reduce the space so that the underline is directly below the navigation link? 

This is the code I use:

 /* navigation underline animation */
.header-nav-item::after {
  content: '';
  background: #FFFFFF; //color
  height: 2px; //thickness
  width: 0;
  display: block;
  margin-top: 1px !important;
  transition: width 0.5s; //animation speed
  margin: 0 auto;
}

.header-nav-item:hover::after {
  width: 100%;
}

.header-nav-item--active a {
    background-image: none !important;
}

 

  • Replies 1
  • Views 352
  • Created
  • Last Reply
Posted
22 hours ago, Elise__ said:

Site URL: https://mandarin-violin-mjw7.squarespace.com

password: elise

Dear squarespace community, 

I have animated underline for my navigation links. However the space between the underline and the link is quite big. How do I reduce the space so that the underline is directly below the navigation link? 

This is the code I use:

 /* navigation underline animation */
.header-nav-item::after {
  content: '';
  background: #FFFFFF; //color
  height: 2px; //thickness
  width: 0;
  display: block;
  margin-top: 1px !important;
  transition: width 0.5s; //animation speed
  margin: 0 auto;
}

.header-nav-item:hover::after {
  width: 100%;
}

.header-nav-item--active a {
    background-image: none !important;
}

 

Add to Design > Custom CSS

.header-nav-item::after {
    top: -10px;
    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!)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.