P
Samuel Adu• 1,010
@samuel-adu
Posted
You can use the change the opacity of an overlay image to achieve that, something like this snippet below.
.img-overlay {
background-color: var(--clr-accent);
border-radius: 10px;
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
opacity: 0;
transition: opacity 0.5s ease;
}
.img-container:hover .img-overlay {
opacity: 0.5;
}
.img-overlay img {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
Marked as helpful
0