Jump to content

Custom button using an image + a different image for hover state

Go to solution Solved by tuanphan,

Recommended Posts

  • Solution

Add this code to Website Tools (under Not Linked) > Custom CSS to add hover image

div#block-yui_3_17_2_1_1701422267607_2792:hover img {
    content: url(https://content.invisioncic.com/p289038/monthly_2023_12/BUTTON-hov.png.391c1b7588c1a9fd61cd83034b4b94e6.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!)

Link to comment
  • 3 weeks later...

how would i accomplish this for ALL button on a website? no need for a hover state change. none of the code i found elsewhere has worked. this is the CSS i currently have:

.sqs-block-button-element--large{
  background-image: url('https://static1.squarespace.com/static/6581ea8652cb8456724660cf/t/658ddec876f305615da42421/1703796429005/brushstroke-gold-1800x690px.png'); 
  background-color: transparent!important; 
  background-size: contain!important; 
  background-position: center; 
  background-repeat: no-repeat!important}

i can tell i'm targeting the button because it goes transparent, but my image (uploaded into SquareSpace) won't show at all.

Link to comment
On 12/29/2023 at 4:38 AM, urbnthstl24 said:

how would i accomplish this for ALL button on a website? no need for a hover state change. none of the code i found elsewhere has worked. this is the CSS i currently have:

.sqs-block-button-element--large{
  background-image: url('https://static1.squarespace.com/static/6581ea8652cb8456724660cf/t/658ddec876f305615da42421/1703796429005/brushstroke-gold-1800x690px.png'); 
  background-color: transparent!important; 
  background-size: contain!important; 
  background-position: center; 
  background-repeat: no-repeat!important}

i can tell i'm targeting the button because it goes transparent, but my image (uploaded into SquareSpace) won't show at all.

Use this code

[class*="-button-"] {
  background-image: url('https://static1.squarespace.com/static/6581ea8652cb8456724660cf/t/658ddec876f305615da42421/1703796429005/brushstroke-gold-1800x690px.png') !important; 
  background-color: transparent !important; 
  background-size: contain !important; 
  background-position: center; 
  background-repeat: no-repeat !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!)

Link to comment

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.