Hover or focus the image to see the effect.
HTML
CSS
.hover-effect.perspective-shift img{
transition: transform 0.5s ease;
}
.hover-effect.perspective-shift:hover img,
.hover-effect.perspective-shift:focus-visible img{
transform: perspective(800px) translateZ(40px) translateX(-25px) scale(1.1);
}
@media (prefers-reduced-motion: reduce) {
.hover-effect.perspective-shift img{
transition: none;
}
.hover-effect.perspective-shift:hover img,
.hover-effect.perspective-shift:focus-visible img{
transform: perspective(800px) translateZ(40px) translateX(-25px) scale(1.1);
}
}
The animates transform: perspective(800px) translateZ(40px) translateX(-25px) scale(1.1) for an off-axis perspective shift. Select the code and copy with Ctrl+C or ⌘C.