Horizontal Stretch

Image stretches horizontally on hover/focus, with a slight vertical zoom to keep the viewport covered.

Horizontal Stretch demo

Hover or focus the image to see the effect.

HTML

description

CSS

.hover-effect.stretch-horizontal img{
  transition: transform 0.5s ease;
}
.hover-effect.stretch-horizontal:hover img,
.hover-effect.stretch-horizontal:focus-visible img{
  transform: scale(1.4, 1.2);
}
@media (prefers-reduced-motion: reduce) {
  .hover-effect.stretch-horizontal img{
    transition: none;
  }
  .hover-effect.stretch-horizontal:hover img,
  .hover-effect.stretch-horizontal:focus-visible img{
    transform: scale(1.4, 1.2);
  }
}

The animates transform: scale(1.4, 1.2) for an asymmetric horizontal stretch with a slight vertical zoom. Select the code and copy with Ctrl+C or ⌘C.