Jump to content

Hover feature (text over image) doesn't work - text always shows

Go to solution Solved by tuanphan,

Recommended Posts

Hello,

I want to include some text that shows when hovering over an image. 

I followed all the steps as I found it online (add image block, add text block above, add background to text, add the following custom-css code: 

@media only screen and (min-width: 640px){
#block-yui_3_17_2_1_1700644683930_48541 {
opacity: 0;
 transition: opacity 1s
}

#block-yui_3_17_2_1_1700644683930_48541:hover {
opacity: 1;
transition: opacity 1s
}
}

 

When I'm in editing mode it seems to work: The image shows and when I hover over it the text appears. However, when I click save and then go to the actual website, the text always shows instead of the image, even when I don't hover over it. 

Anyone knows what the issue is?
 

Thank you

Link to comment
  • Replies 4
  • Views 1.1k
  • Created
  • Last Reply

Top Posters In This Topic

  • Solution

Try adding !important to the code, the new code should be

@media only screen and (min-width: 767px){
#block-yui_3_17_2_1_1700644683930_48541 {
opacity: 0 !important;
 transition: opacity 1s;
}

#block-yui_3_17_2_1_1700644683930_48541:hover {
opacity: 1 !important;
transition: opacity 1s;
}
}

 

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
14 hours ago, tuanphan said:

Try adding !important to the code, the new code should be

@media only screen and (min-width: 767px){
#block-yui_3_17_2_1_1700644683930_48541 {
opacity: 0 !important;
 transition: opacity 1s;
}

#block-yui_3_17_2_1_1700644683930_48541:hover {
opacity: 1 !important;
transition: opacity 1s;
}
}

 

Perfect, that worked! Thank you so much 🙂

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.