Jump to content

Underlining x apparition/animation effect on hover - Navigation Links - Header

Go to solution Solved by tuanphan,

Recommended Posts

Posted

Site URL: https://oriole-oarfish-95cc.squarespace.com/

Hi, 

Using site-wide animation -> With the "flex" animation, I've noticed that the header navigation links get a nice effect : when hovering a link, an underlining effect appears with a slight animation of apparition. 

I would like to use the "Slide" effect (and not the flex animation). How can I please reproduce the same hover effect on my animation links?

Password : clublulu2024

Thanking you very much in advance, 

Lucie 

  • Replies 4
  • Views 135
  • Created
  • Last Reply

Top Posters In This Topic

Posted

Hi @LucieGbt1993 To achieve this, you’ll need to use a custom code. Here it is:

  1. Navigate to Pages > Website Tools > Custom CSS.
  2. Paste the code into the CSS editor.
  3. Hit Save and you’re done
/* Navigation link underline animation */
.header-nav-item > a:after {
  content: ''; /* Creates a pseudo-element for the underline */
  width: 0px; /* Initial width of the underline */
  height: 1px; /* Thickness of the underline */
  background: #000; /* Underline color */
  display: block; /* Ensures it behaves like a block element */
  transition: width 0.2s ease; /* Smooth animation for the width change */
}

/* Removes background from active or hovered links */
.header-nav-item > a, .header-nav-folder-item:hover {
  background: none !important; /* Ensures no background is applied */
}

/* Active or hover state for main navigation links */
.header-nav-item--active > a:after, 
.header-nav-item:hover > a:after, 
.header-nav-folder-item:hover > a:after {
  width: 100% !important; /* Expands the underline to the full width of the link */
}

/* Folder item underline animation */
.header-nav-folder-item > a:after {
  content: ''; /* Creates a pseudo-element for folder links */
  width: 0px; /* Initial width of the underline */
  height: 1px; /* Thickness of the underline */
  background: #000; /* Underline color */
  display: block; /* Ensures it behaves like a block element */
  transition: width 0.2s ease; /* Smooth animation for the width change */
}

Hope it helps.

- Answered by Iuno from sparkplugin.com

forumsignature-recommendedcopy2.png.0579645eb1430dc7c1059541dc6456c6.png

Posted

Hi, 

Thanks so much, it worked perfectly. The only remaining problem is that on the secondary navigation menu (dropdown menu navigation links), the underlining effects fits the dropdown menu container and not the actual navigation link. How can this be fixed please? See screenshot attached. 

 

Thanking you very much for your help, 

Lucie 

 

 

Capture d’écran 2024-11-22 à 09.39.41.png

  • Solution
Posted
On 11/22/2024 at 3:40 PM, LucieGbt1993 said:

Hi, 

Thanks so much, it worked perfectly. The only remaining problem is that on the secondary navigation menu (dropdown menu navigation links), the underlining effects fits the dropdown menu container and not the actual navigation link. How can this be fixed please? See screenshot attached. 

 

Thanking you very much for your help, 

Lucie 

 

 

Capture d’écran 2024-11-22 à 09.39.41.png

You can use extra CSS code

div.header-nav-folder-content a {
    display: inline-block;
}

image.png.12bea5957d4515dae5d6204a95c2c752.png

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.