3D Perspective Zoom

Image moves forward in 3D space on hover/focus, creating apparent depth via translateZ plus a controlled scale.

3D Perspective Zoom demo

Hover or focus the image to see the effect.

HTML

description

CSS

.hover-effect.perspective-zoom img{
  transition: transform 0.5s ease;
}
.hover-effect.perspective-zoom:hover img,
.hover-effect.perspective-zoom:focus-visible img{
  transform: perspective(800px) translateZ(60px) scale(1.25);
}
@media (prefers-reduced-motion: reduce) {
  .hover-effect.perspective-zoom img{
    transition: none;
  }
  .hover-effect.perspective-zoom:hover img,
  .hover-effect.perspective-zoom:focus-visible img{
    transform: perspective(800px) translateZ(60px) scale(1.25);
  }
}

The animates transform: perspective(800px) translateZ(60px) scale(1.25) for a 3D pop-forward effect. Select the code and copy with Ctrl+C or ⌘C.