I’m trying to create a hover effect for an image whereby:
- A headline text is revealed
- This headline text acts a clipping mask over the image
in this image, state 1 (no hover) is on the left. you just see the image. state 2 (hover) is on the right. text would appear as a clipping mask for the image, so you only see the image through the text when hovered.
This text would be a hyperlink to a different page
I’ve tried using css background-clip
as described here to make this work, but I couldn’t get it so that the first state was just the image, no text outline.
Can anyone help?
I’d really love a whole grid of these images, acting as thumbnails for different blog posts!
thank you!
2
Answers
You mean like this?
It was necessary to have a parent div with the same background, and hide it on hovering.
Each item in the gallery can have a background image which covers the item and then on hover the background is clipped to the text.
This snippet has the gallery as a CSS grid with square items, but of course alter this to whatever layout you require.
This snippet gives this sort of effect: