Jump to content

Add Hover State to Images (Change Opacity + Add Text)

Recommended Posts

Site URL: https://www.mayakagan.com/

Hello!

I'd like to add a hover state to the images on my homepage. I created a bespoke layout but lost the hover state ability because the images are not uniform. I'm not using a gallery like masonry grid, I simply added a blank page and added images and spacers from there.

My goal is to have the title appear in the center of the image and for the image itself to fade to black (lowered opacity).

Thank you!

Link to comment
  • Replies 2
  • Views 669
  • Created
  • Last Reply

Top Posters In This Topic

18 hours ago, MayatheKay said:

Site URL: https://www.mayakagan.com/

Hello!

I'd like to add a hover state to the images on my homepage. I created a bespoke layout but lost the hover state ability because the images are not uniform. I'm not using a gallery like masonry grid, I simply added a blank page and added images and spacers from there.

My goal is to have the title appear in the center of the image and for the image itself to fade to black (lowered opacity).

Thank you!

Hi,

What is access password?

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
  • 2 weeks later...
On 9/16/2021 at 1:41 AM, MayatheKay said:

Site URL: https://www.mayakagan.com/

Hello!

I'd like to add a hover state to the images on my homepage. I created a bespoke layout but lost the hover state ability because the images are not uniform. I'm not using a gallery like masonry grid, I simply added a blank page and added images and spacers from there.

My goal is to have the title appear in the center of the image and for the image itself to fade to black (lowered opacity).

Thank you!

Add to Design > Custom CSS

/* Homepage Image Hover */
body.homepage {
figure a:after {
    content: "";
    background-color: rgba(0,0,0,0.5);
    position: absolute;
    z-index: 900;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}
figcaption.image-caption-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    width: 100%;
    text-align: center;
    z-index: 9999;
    color: white;
    opacity: 0;
    pointer-events: none;
}
.image-block:hover figcaption.image-caption-wrapper {
    opacity: 1;
}
.image-block:hover figure a:after {
    opacity: 1;
}}

 

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.