Hover or focus the image to see the effect.
HTML
CSS
.hover-effect.high-contrast.focus img{
transition: filter 0.5s ease;
}
.hover-effect.high-contrast.focus:hover img,
.hover-effect.high-contrast.focus:focus-visible img{
filter: contrast(1.8);
}
@media (prefers-reduced-motion: reduce) {
.hover-effect.high-contrast.focus img{
transition: none;
}
.hover-effect.high-contrast.focus:hover img,
.hover-effect.high-contrast.focus:focus-visible img{
filter: contrast(1.8);
}
}
The animates filter: contrast() to 1.8 on hover/focus-visible. The wrapper carries the focus class as a marker and tabindex="0" so it is keyboard-focusable. Select the code and copy with Ctrl+C or ⌘C.