Vertical Stretch

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

Vertical Stretch demo

Hover or focus the image to see the effect.

HTML

description

CSS

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

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