Hover or focus the image to see the effect.
HTML
CSS
.hover-effect.contrast-decrease img{
filter: contrast(1);
transition: filter 0.5s ease;
}
.hover-effect.contrast-decrease:hover img,
.hover-effect.contrast-decrease:focus-visible img{
filter: contrast(0.5);
}
@media (prefers-reduced-motion: reduce) {
.hover-effect.contrast-decrease img{
transition: none;
}
.hover-effect.contrast-decrease:hover img,
.hover-effect.contrast-decrease:focus-visible img{
filter: contrast(0.5);
}
}
The animates filter: contrast() from 1 to 0.5. Select the code and copy with Ctrl+C or ⌘C.