Jump to content

Creating a text and colour overlay on hover on an image block

Go to solution Solved by Beyondspace,

Recommended Posts

Site URL: https://hooshdesigns.com.au/community-copy

Hi all,

Since some changes to Squarespace, I've been struggling to implement the text and colour overlay on hover to image blocks.

On the page I'm working on, I have a row of six images with text blocks and accordions below them, and I'm looking to add a text and colour overlay on hover to each of the six images. I have been using different code I've found elsewhere, but have not been able to crack it.

The effect I'm after is essentially this one, but I'm having trouble targeting classes/id's to make it work.

https://www.w3schools.com/howto/howto_css_image_overlay.asp

If anyone has any suggestions, I would be hugely appreciative!

Link to comment
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • Solution
On 8/5/2022 at 12:46 PM, tdm91 said:

Site URL: https://hooshdesigns.com.au/community-copy

Hi all,

Since some changes to Squarespace, I've been struggling to implement the text and colour overlay on hover to image blocks.

On the page I'm working on, I have a row of six images with text blocks and accordions below them, and I'm looking to add a text and colour overlay on hover to each of the six images. I have been using different code I've found elsewhere, but have not been able to crack it.

The effect I'm after is essentially this one, but I'm having trouble targeting classes/id's to make it work.

https://www.w3schools.com/howto/howto_css_image_overlay.asp

If anyone has any suggestions, I would be hugely appreciative!

You can try adding to Home > Design > Custom Css

section[data-section-id="62eca74a6d9b2e0497d75203"] .image-block  .content-fill:after {
  content:'Here is the title';
  color: #fff; /*color of title overlay*/
  display: flex;
  justify-content:center;
  align-items: center;
  background: rgba(0,0,0,0.3); /*background color overlay*/
  width: 100%;
  height: 100%;
  position: absolute;  
  opacity: 0;
  transition: opacity 0.5s;
}


section[data-section-id="62eca74a6d9b2e0497d75203"] .image-block:hover .content-fill:after{
  opacity: 1;
}

Let me know how it works on your site

Support me by pressing 👍 if this useful for you

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment

My testing

image.thumb.png.839c7ec083f00e2c191fba4ac76fdee3.png

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. 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.