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

推荐订阅源

I
InfoQ
G
Google Developers Blog
Engineering at Meta
Engineering at Meta
月光博客
月光博客
博客园 - 聂微东
博客园 - Franky
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
有赞技术团队
有赞技术团队
A
About on SuperTechFans
Microsoft Azure Blog
Microsoft Azure Blog
Blog — PlanetScale
Blog — PlanetScale
U
Unit 42
T
Tailwind CSS Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
云风的 BLOG
云风的 BLOG
S
SegmentFault 最新的问题
F
Fortinet All Blogs
H
Help Net Security
J
Java Code Geeks
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 叶小钗
L
LangChain Blog
Martin Fowler
Martin Fowler
N
Netflix TechBlog - Medium

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.