Jump to content

Edit button style for animated hover button

Recommended Posts

Posted

Hello,

I have used the below CSS code (bottom of this post) previously on a website to style and animate the hover on a button.

The hover is working okay, however I can't seem to get the styling right. There are a couple of issues:

1. The font needs to be custom (I have custom CSS fonts on the site currently)

2. The static style of the button should have a line as per the below example:

ScreenShot2024-04-03at12_02_39am.png.7fbd1e2b2ebd69cfdc2f69f83e817c1b.png

...then on hover it should animate a new colour like the below:

ScreenShot2024-04-03at12_02_50am.png.3183a09fc42add49adb4cf72d4d7ca1c.png

This is what my website is currently looking like (the line is not appearing prior to hover):

ScreenShot2024-04-03at12_10_39am.png.4464d492251f14bb4d247e8aba41e9e7.png 

....what it currently looks like on hover:

ScreenShot2024-04-03at12_11_12am.png.965861a42b661d8ff9ca7c6157293d54.png

 

3. I would like the button text to sit left aligned to the line. Because the website copy is left aligned, it looks odd as centred.

 

BELOW is the code I currently have:

 

/*CUSTOM BUTTON STYLES*/

.sqs-block-button-element {
  position: relative !important;   
  height: 50px !important;          
  text-align: left !important;     
  transition: 0.6s !important;     
  padding: 0px !important;      
  -webkit-transition: 0.6s !important; 
}  

.sqs-block-button-element {     
  background-color: transparent !important;     
  border: 2px solid #transparent !important;     
  color: #a29772 !important; 
}  

.sqs-block-button-element:hover:before {     
  transition-delay: .3s !important; 
}  
.sqs-block-button-element:before {     
  width: 0% !important;     
  height: 100% !important;     
  z-index: 2 !important;     
  content: '' !important;    
  position: absolute !important;     
  bottom: 2px !important;    
  left: 0 !important;    
  box-sizing: border-box !important;    
  transition: .3s !important; 
}  

.sqs-block-button-element:hover:before {     
  width: 100% !important;     
  transition: .5s !important; } 

.sqs-block-button-element:before {     
  border-bottom: 1.5px solid #a29772 !important; 
}

 

Would very much appreciate any help!

 

  • Replies 0
  • Views 1.3k
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Posted Images

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.