Presets

CSS zoom in on image (hover effect)

The picture scales up gently inside a fixed frame when the pointer moves over it.

CSSTailwindReactGIFMP4
00.000 / 0.600s
timing
style

npm i motion · the component uses motion/react

How it works

This is the standard way to zoom in on an image on hover with CSS: the picture grows slightly while its frame stays the same size, so it looks like the camera moved closer. It is used on product grids, blog cards and portfolio thumbnails.

Two elements do the work. The outer frame has a fixed Width and Height, a Corner radius and overflow: hidden. The image inside fills it at 100% and starts at transform: scale(1). On hover it transitions to scale(Zoom), and the frame crops whatever spills over its edges. The preview uses a gradient placeholder with role="img"; in your project put a real img there with object-fit: cover and a meaningful alt text.

Parameters: Width, Height, Zoom, Corner radius, Duration and Easing. Zoom between 1.05 and 1.15 feels natural; beyond 1.3 important parts of the photo get cropped. The default expo-out easing with 0.6s gives a quick start and a long, soft finish, which matters more here than on small UI elements because the image is large.

Scaling with transform is handled by the GPU and does not reflow the grid. Upscaling does reveal low-resolution sources, so serve images at least Zoom times the display size. If the image sits inside a link, also apply the zoom on :focus-visible of that link so keyboard users get the same feedback.

How do I use this with a real img tag?

Keep the frame element and replace the inner placeholder with an img that has width: 100%, height: 100%, object-fit: cover and display: block. Move the transform and transition rules to the img. The frame's overflow: hidden and border-radius still crop the zoomed image, including the rounded corners.

Why do the rounded corners sometimes flicker during the zoom?

Some browsers briefly ignore overflow clipping with border-radius when a child gets its own compositing layer. Adding isolation: isolate or transform: translateZ(0) to the frame usually fixes it, because the frame then clips its own layer. It is a rendering quirk, not a problem with the effect itself.

Can the image zoom out on hover instead?

Yes. Start the image at a larger scale such as 1.12 and transition to scale(1) on hover. That shows more of the picture when the user points at it, which works well for galleries where the cropped thumbnail hides context. Set the Zoom value in the editor and swap the two transform values in the copied CSS.

relatedMore like this

all hover effects →
Card title Hover to lift this card.
01 Card lift on hover hover
02 Underline grow link hover
03 Fill sweep button hover
Pro feature The border glows on hover.
04 Glow border on hover hover
05 Arrow nudge button hover

Export

format
height

480p max · small watermark · 3 per day · remove limits