gpt4 book ai didi

CSS 变换 : scale does not change DOM size?

转载 作者:技术小花猫 更新时间:2023-10-29 11:46:13 24 4
gpt4 key购买 nike

Container 变换后的 DOM 宽度是否与变换前相同?

为什么?

var theScale = aNumber;
var containerWidth = theContainer.width();
alert(containerWidth);

// and the other prefixes, as well
theContainer.css("-webkit-transform", "scale(" + theScale + ")");

containerWidth = theContainer.width();
alert(containerWidth); // the same value ???

最佳答案

变换不会影响元素的布局——或者更准确地说是盒子模型。它们纯粹是装饰性的。来自spec :

Note: Transformations do affect the visual layout on the canvas, but have no affect on the CSS layout itself. This also means transforms do not affect results of the Element Interface Extensions getClientRects() and getBoundingClientRect(), which are specified in [CSSOM-VIEW].

关于CSS 变换 : scale does not change DOM size?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32835144/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com