# Zoom on Hover

> Smoothly zooms an image inside its frame on hover without changing the layout.

- Category: [CSS Effects](https://copy-css.com/category/effects)
- Tags: image, zoom, hover, scale, gallery
- Live preview: https://copy-css.com/snippets/zoom-on-hover
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<div class="zoom-frame">
  <img alt="Sun over blue hills" width="220" height="150" src="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 22 15%27%3E%3Crect width=%2722%27 height=%2715%27 fill=%27%236366f1%27/%3E%3Ccircle cx=%277%27 cy=%275%27 r=%273%27 fill=%27%23fde047%27/%3E%3Cpath d=%27M0 15 8 8l5 4 4-3 5 6z%27 fill=%27%230ea5e9%27/%3E%3C/svg%3E">
</div>
```

## CSS

```css
.zoom-frame {
  overflow: hidden;
  border-radius: 14px;
}

.zoom-frame img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.zoom-frame:hover img {
  transform: scale(1.08);
}
```

## Notes

- This CSS Zoom on Hover is 15 lines of pure CSS (0.2 KB) with no JavaScript and no dependencies. It uses transitions and transforms.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
