Published at
Updated at
Reading time
1min
This post is part of my Today I learned series in which I share all my web development learnings.

You probably know that you can use the scale function scale() or even just scale property to transform and change an element's size.

The thing with scale is that it only changes visual appearance and the layout size of the target element remains the same.

Today I learned there's also the zoom property. zoom "really" scales the element and its layout. Check this out!

1
zoom: 1
120×120
zoom scales the element and its layout.
transform: scale(1)
120×120
transform: scale() scales visually but the layout footprint stays at 120×120.

What's the browser support?

MDN Compat Data (source)
Browser support info for zoom
chromechrome_androidedgefirefoxfirefox_androidsafarisafari_iossamsunginternet_androidwebview_android
11121261263.131.51

It's pretty green!

I can totally see contrained situations when this can come in handy, but you should avoid animating it, because browsers probably don't appreciate the layout shift.

If you enjoyed this article...

Join 6.5k readers and learn something new every week with Web Weekly.

Reply to this post and share your thoughts via good old email.
Stefan standing in the park in front of a green background

About Stefan Judis

Frontend nerd with over ten years of experience, freelance dev, "Today I Learned" blogger, conference speaker, and Open Source maintainer.

Related Topics

Related Articles