CSS缩放的替代解决方案(Alternate solution for CSS zoom)

编程入门 行业动态 更新时间:2024-10-26 02:36:21
CSS缩放的替代解决方案(Alternate solution for CSS zoom)

我使用CSS zoom来缩小大div的预览。

<div id="layoutEditCanvas" style="width:1920px;height:1080px;background:url('{{layout.backgroundImage}}')"> </div>

zoom设置如下:

zoom:0.5;

现在,FF不支持zoom所以我必须使用

-moz-transform: scale(0.5); -moz-transform-origin: 0 0;

我的问题是,当Chrome使用CSS zoom并将我的div缩小到960 x 540时,FF会将div保留为原始大小并仅缩放其内容,从而在缩小内容周围留下巨大的空白空间。

是否有一个参数让(缩放)变换表现得像zoom ?

I use CSS zoom to shrink the preview of a big div.

<div id="layoutEditCanvas" style="width:1920px;height:1080px;background:url('{{layout.backgroundImage}}')"> </div>

zoom set like this:

zoom:0.5;

Now, FF doesn't support zoom so I have to use

-moz-transform: scale(0.5); -moz-transform-origin: 0 0;

My problem is that while Chrome takes the CSS zoom and shrinks my div to 960 x 540, FF leaves the div with its original size and only scales its contents, leaving me with a huge empty space around the shrunk content.

Is there a parameter to have the (scale) transform to behave like zoom?

最满意答案

你可以将所有内容包装在另一个div中并将该比例设置为该包装器上的.5吗?

I found that it's possible to avoid this effect by setting fixed height/width and overflow:hidden on the element wrapping the "transform scale"'d element, thus hiding that overflow created by the scaling.

更多推荐

本文发布于:2023-08-05 00:05:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1423287.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:缩放   解决方案   CSS   zoom   solution

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!