Jump to content

Disappearing underline on button hover effect

Go to solution Solved by tuanphan,

Recommended Posts

Posted

Would anyone happen to know how to customize the button like the one in this site?

There's an existing underline on the button and when you hover over it, the underline disappears. I'd like to create the same effect with CSS!

Posted
On 6/25/2023 at 2:36 PM, ssjewelry said:

Add to Design > Custom CSS

/* Button underline */
a.sqs-block-button-element--small.sqs-button-element--tertiary.sqs-block-button-element:after {
    content: "";
    background-color: white;
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    bottom: 0;
    transition: all 0.3s ease;
}
a.sqs-block-button-element--small.sqs-button-element--tertiary.sqs-block-button-element {
    position: relative;
}
a.sqs-block-button-element--small.sqs-button-element--tertiary.sqs-block-button-element:hover:after {
    width: 0;
    transition: all 0.3s ease;
}

 

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

  • Solution
Posted
12 minutes ago, ssjewelry said:

Would it be possible to have the underline disappear from both sides? 
Almost like the disappearance converges into the middle 🙂

THANK YOU!

Use this new code

a.sqs-block-button-element--small.sqs-button-element--tertiary.sqs-block-button-element:after {
    content: "";
    background-color: #fff;
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    bottom: 0;
    transition: all .3s ease;
    transform: scale(1);
}

a.sqs-block-button-element--small.sqs-button-element--tertiary.sqs-block-button-element {
    position: relative;
}

a.sqs-block-button-element--small.sqs-button-element--tertiary.sqs-block-button-element:hover:after {
    transform:scale(0);
    transition: all .3s ease;
}

 

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

Posted
16 hours ago, ssjewelry said:

Hi @tuanphan!

Would you know how to shorten the button underline so it's the same length as the text? 🙂

https://www.susiesaltzman.com/new-home

Add this CSS under

a.sqs-block-button-element--small.sqs-button-element--tertiary.sqs-block-button-element {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

 

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

Posted

Hello again @tuanphan

I created a "medium" version of the button so I can have it in a different color, but I'm not seeing the underline effect. Can you kindly help please? 🙂 

https://www.susiesaltzman.com/


Here is the code I used:

Quote

/* BUTTON UNDERLINE */
a.sqs-block-button-element--medium.sqs-button-element--tertiary.sqs-block-button-element:after {
    content: "";
    background-color: #50332e;
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    bottom: 0;
    transition: all .3s ease;
    transform: scalex(1);
}

a.sqs-block-button-element--medium.sqs-button-element--tertiary.sqs-block-button-element {
    position: relative;
}

a.sqs-block-button-element--medium.sqs-button-element--tertiary.sqs-block-button-element:hover:after {
    transform:scalex(0);
    transition: all .3s ease;
}

a.sqs-block-button-element-medium.sqs-button-element--tertiary.sqs-block-button-element {
    padding-left: 0 !important;
    padding-right: 0 !important;
}



image.thumb.png.a66fcf350f5e2f42ae410a963ec19463.png

Posted (edited)
6 hours ago, ssjewelry said:

Hello again @tuanphan

I created a "medium" version of the button so I can have it in a different color, but I'm not seeing the underline effect. Can you kindly help please? 🙂 

https://www.susiesaltzman.com/


Here is the code I used:



image.thumb.png.a66fcf350f5e2f42ae410a963ec19463.png

This code for Medium button but use Tertiary style

But your button uses Primary Style

So if you want to use that code, you need to change button to Tertiary style

OR If you want to use Primary style, you need to change "tertiary" in the code to "primary"

Edited by tuanphan

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

  • 1 year later...

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.