惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

MyScale Blog
MyScale Blog
博客园 - 司徒正美
A
About on SuperTechFans
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
爱范儿
爱范儿
I
InfoQ
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园_首页
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
F
Fortinet All Blogs
S
SegmentFault 最新的问题
阮一峰的网络日志
阮一峰的网络日志
D
Docker
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
M
MIT News - Artificial intelligence
Jina AI
Jina AI
H
Help Net Security
量子位
IT之家
IT之家

Stefan Judis Web Development

Web Weekly #199 Web Weekly #198 Web Weekly #197 Michelle Barker on Stage Fright Web Weekly #196 Escape from Average Web Weekly #195 Web Weekly #194 Web Weekly #193 Web Weekly #192 Web Weekly #191 Web Weekly #190 Web Weekly #189 Web Weekly #188 Intl can localize units, too! The scope of type guards and assertion functions Web Weekly #187 Web Weekly #186 Web Weekly #185 New lines are removed from WHATWG URLs Web Weekly #184 Nobody owes you anything Notes on relying on the ARIA Authoring Practices Guide Web Weekly #183 Web Weekly #182 How to style the found search / "find in page" substrings Web Weekly #181 Web Weekly #180 ARIA roles can remove their children’s semantics Clean up your Mac with open source
How to scale elements and their layout with CSS "zoo...
Stefan Judis · 2026-02-24 · via Stefan Judis Web Development

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!

Scale factor:1

zoom: 1

zoom scales the element and its layout.

transform: scale(1)

transform: scale() scales visually but the layout footprint stays at 120×120.

What's the browser support?

It's pretty green!

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

Someone pointed out that there are still browser inconsistencies for zoomed elements. Boooh!

Apparently, Safari doesn't return the updated element layout size if you use getBoundingClientRect(). width and height remain the initial size of 120px time 120px (tested in Safari 26.3).

Chrome and Firefox work as expected.