如何缩放嵌入< object>的固执SVG标签? [英] How do I scale a stubborn SVG embedded with the <object> tag?

查看:174
本文介绍了如何缩放嵌入< object>的固执SVG标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些SVG文件指定了 width height 以及 viewbox 像这样:

I have some SVG files that specifies width and height as well as viewbox like this:

<svg width="576pt" height="432pt" viewBox="0 0 576 432" > ...

但是如何以我决定的大小在浏览器中显示它们?我想让它们变小一些,并尝试过:

but how to display them in the browser at a size I decide? I want them smaller and have tried:

<object width="400" data="image.svg"></object>

但是我得到可见的滚动条。

but then I get visible scrollbars.

如果我更改SVG文件以将宽度高度设置为 100% / code>代替,但我想要决定HTML中的大小,而不管SVG文件中使用了什么大小。这可能吗 ?

It works if I change the SVG files to set width and height to 100% instead, but I want to decide the size in the HTML regardless of what sizes are used in the SVG file. Is this possible ?

推荐答案

在2009年问及此问题时,这里给出的答案都不适用于我。因为我现在再次遇到同样的问题我注意到使用< img> 标记和宽度以及svg都可以正常工作。

None of the answers given here worked for me when I asked this back in 2009. As I now had the same issue again I noticed that using the <img> tag and width together with an svg works fine.

<img width="400" src="image.svg">

这篇关于如何缩放嵌入&lt; object&gt;的固执SVG标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆