CSS zoom: How to Scale Elements and How It Differs from transform: scale()
Writing 1.5 or 150% for the zoom property enlarges an element, including its contents, to 1.5 times its size. The big difference from transform: scale() is layout. An element enlarged with zoom also takes up more space, so the elements after it get pushed down. scale() makes only the appearance larger, and the surrounding elements stay where they were.
.card {
zoom: 1.5; /* same as writing 150% */
}
The test environment was Ubuntu 24.04, Node.js 22.23.4, Playwright 1.63.0, and Chromium 153. I opened a page made only of HTML and CSS in Playwright and recorded values such as getBoundingClientRect() and getComputedStyle(). I did not test Firefox, Safari, or real smartphones. The browser versions in the support sections come from the compatibility data (@mdn/browser-compat-data 8.1.8).
- 1. Accepted values: numbers and percentages
- 2. zoom pushes following elements, scale() overlaps them
- 3. Line wrapping changes when no width is set
- 4. zoom does not scale percentage and auto values
- 5. Nesting multiplies
- 6. Values readable from JavaScript
- 7. zoom and scale() can be combined
- 8. zoom changes can be animated
- 9. Browser support
- 10. Which one to use
Accepted values: numbers and percentages
zoom takes a number such as 1.5 or a percentage such as 150%. Values above 1 (100%) enlarge the element, and values below 1 shrink it. The initial value is 1.
I used CSS.supports() in Chromium 153 to check. 1.5, 150%, calc(1 + 0.5), and normal were accepted. -1, -50%, and 2px were not. The specification (CSS Viewport Module Level 1) also says that negative values are not allowed.
0 and 0% are accepted, but the specification treats them the same as 1. In the test environment, the computed value of zoom: 0 was 1, and the element kept its original size. Writing 0 to make an element disappear does not work.
MDN lists normal and reset as non-standard values. normal means the same as 1. In the test environment, its computed value was 1. According to the compatibility data, reset was removed in Chrome 59 and Safari 18.4, and Chromium 153 did not accept it either.
zoom pushes following elements, scale() overlaps them
I placed a paragraph right after a box that is 200px wide and 100px tall (with padding of 10px and border of 2px). Then I compared zoom: 1.5 and transform: scale(1.5) on the box.
| CSS on the box | Visual position and size of the box | Top edge of the next paragraph |
|---|---|---|
| None | x=20, y=20, 224×124 | 160px |
zoom: 1.5 |
x=20, y=20, 336×186 | 222px |
transform: scale(1.5) |
x=-36, y=-11, 336×186 | 160px |
The visual size is 336×186 in both cases. The difference is the direction of growth and the effect on the surroundings.
The box with zoom: 1.5 kept its top-left position and grew to the right and downward. Because the box takes up more space in the layout, the next paragraph moved down by 62px.
The box with transform: scale(1.5) grew in all directions from its center. Its top-left corner moved to x=-36, which is past the left edge of the screen. The next paragraph did not move, so the enlarged box overlaps it. You can change the growth direction with transform-origin. With transform-origin: 0 0, the box grew from its top-left corner. For a box with zoom, adding transform-origin did not change the position or size.

Shrinking works the same way. With zoom: 0.5, the box became 112×62, and the next paragraph moved up by 62px. With transform: scale(0.5), the box shrank toward its center, leaving a gap equal to the original size before the next paragraph.
zoom also enlarges margin. When I gave a box with margin: 50px the value zoom: 2, its top-left corner was at (100, 100).
Line wrapping changes when no width is set
If you add zoom to a block element that has no set width, the element keeps the width of its parent and only the text gets larger. As a result, fewer characters fit on each line and the number of lines increases.
I tested a paragraph inside a parent that is 400px wide. Without any change, the text took 2 lines. With zoom: 1.5, it took 3 lines, and the element stayed 400px wide. With transform: scale(1.5), the text stayed at 2 lines and the whole element grew 1.5 times to 600px wide, extending past its parent.

zoom makes the font size and the lengths of spacing larger first, and then recalculates the layout. scale() stretches the result after layout is finished, so line wrapping does not change.
zoom does not scale percentage and auto values
The specification says that zoom scales length values such as px and em, but does not scale values whose computed value is auto or a percentage.
In a parent that is 400px wide, I gave an element width: 50%, padding: 10px, and border: 2px, and then zoom: 2. Its visual width went from 224px to 248px. The 200px from width: 50% stayed the same, and only the 24px from padding and border doubled. The height was set as a length of 40px, so it doubled exactly, from 64px to 128px.
An image with no set size is enlarged from its natural size. When I placed a 120×60 SVG image inside an element with zoom: 2, it was displayed at 240×120.
Nesting multiplies
If you put an element with zoom: 2 inside another element with zoom: 2, the inner text becomes four times its original size. In the test environment, the outer text was 46px tall and the inner text was 92px tall, which is twice the outer size.
getComputedStyle() returns the value written on each element (both are 2 here). zoom is not inherited, so the computed value of a child inside a zoom: 2 element was 1. To get the actual magnification, including the factor inherited from parents, read Element.currentCSSZoom. For an element with zoom: 1.5 inside a zoom: 2 element, currentCSSZoom was 3. For an element with transform: scale(3), currentCSSZoom stayed 1.
Values readable from JavaScript
These are the values that each JavaScript API returned when I enlarged a box by 1.5 times.
| Value read | No change | zoom: 1.5 |
transform: scale(1.5) |
|---|---|---|---|
Width from getBoundingClientRect() |
224 | 336 | 336 |
offsetWidth |
224 | 224 | 224 |
clientWidth |
220 | 220 | 220 |
width from getComputedStyle() |
200px | 200px | 200px |
Only getBoundingClientRect() returned the size that is visible on screen. offsetWidth and getComputedStyle() returned the pre-enlargement values in both cases. For zoom, this distinction is described in the specification and on MDN's currentCSSZoom page. Multiplying the pre-enlargement value by currentCSSZoom gives the visual size.
In the test environment, offsetX at the clicked position returned different values depending on how the element was enlarged. I tripled a 100px-wide element and clicked 150px from its visual left edge.
| Method of enlargement | clientX |
offsetX |
|---|---|---|
zoom: 3 (zoom: 1.5 inside zoom: 2) |
150 | 150 |
transform: scale(3) (transform-origin: 0 0) |
150 | 50 |
With transform, offsetX returned the coordinate in the element's pre-enlargement space (150 ÷ 3 = 50). With zoom, it returned 150, the visual value unchanged. In Chromium 153, if you calculate a position inside an element using offsetX, you need to handle zoom elements differently from the others.
zoom and scale() can be combined
The specification says that zoom does not affect enlargement by transform. When I gave the same element zoom: 2 and transform: scale(1.5), a 100px-wide box appeared 300px wide (3 times). The box took up 2 times the space through zoom, and then only its appearance was enlarged by an additional 1.5 times.
zoom changes can be animated
In Chromium 153 in the test environment, I added transition: zoom 1s linear and changed zoom from 1 to 2. One zoom transition was created. At 0.5 seconds, the computed value was 1.5, and the visual width went from 100px to 150px.
However, according to the compatibility data, animating zoom is supported from Chrome and Edge 150 and from Firefox 126, but not in Safari. MDN also explains that scale() does not trigger a layout recalculation. For animations that only need to look larger, transform: scale() is the better choice because it does not redo the layout.
Browser support
The compatibility data shows the following support.
| Browser | zoom |
Animating zoom |
currentCSSZoom |
|---|---|---|---|
| Chrome | from 1 | from 150 | from 128 |
| Edge | from 12 | from 150 | from 128 |
| Firefox | from 126 | from 126 | from 126 |
| Safari (including iOS) | from 3.1 (3 on iOS) | Not supported | from 26.4 |
Chrome and Safari have supported zoom for a long time, but Firefox added support only from version 126. The notes in the compatibility data say that before Firefox 131, SVG elements were not enlarged correctly.
Which one to use
Use zoom when you want to enlarge an element along with the layout around it, meaning you want the following elements to be pushed down and the text to be rewrapped.
Use transform: scale() when you want to change only the appearance temporarily, such as a small enlargement on hover. Surrounding elements do not move, and line wrapping does not change. For a method that enlarges an image inside its frame, see the separate article "How to Enlarge an Image Within Its Frame on Hover with CSS."





