I am facing an issue where I have an image with a centered absolutely positioned link on top of it. When I hover over the image, there are transition effects in place which work perfectly fine. However, when I hover over the link, these transition effects are lost.
HTML
<div class="imagediv">
<img src="#">
<a href="#">Text</a>
</div>
CSS
.imagediv img {
transition: transform 0.2s linear;
}
.imagediv img:hover{
transform: scale(1.2);
filter: grayscale(50%);
}
.imagediv a {
position: absolute;
z-index: 2;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
Is there a way for me to ensure that my image hover effects also remain intact when hovering over the link?