Hover or focus the image to see the effect.
HTML
<div class="hover-effect fade-overlay-light">
<img src="image.jpg" alt="description">
</div>
</div>
CSS
.hover-effect.fade-overlay-light{
position: relative;
}
.hover-effect.fade-overlay-light::before{
content: "";
position: absolute;
inset: 0;
background: rgba(255, 255, 255, 0.6);
opacity: 0;
transition: opacity 0.45s ease;
}
.hover-effect.fade-overlay-light:hover::before,
.hover-effect.fade-overlay-light:focus-visible::before{
opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
.hover-effect.fade-overlay-light::before{
transition: none;
}
.hover-effect.fade-overlay-light:hover::before,
.hover-effect.fade-overlay-light:focus-visible::before{
opacity: 1;
}
}
Select the code and copy with Ctrl+C or ⌘C.