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