如何在SVG中不缩放图像 [英] How to NOT scale an image in SVG
本文介绍了如何在SVG中不缩放图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以我在SVG中有一个图像,如下所示:
So I have an image in SVG as follows:
<image id="svgBackground" x="0px" y="0px" width="100%" height="100%" preserveAspectRatio="xMinYMin" xlink:href="backgrounds.png"/>
我希望浏览器以原始尺寸显示图像.我该怎么办?
I want the browser to show the image at the original size. How do I do that?
推荐答案
使用"px"单位指定图像的原始大小:width="150px" height="100px"
或应该的任何大小.
Specify the image's original size using "px" units: width="150px" height="100px"
or whatever it ought to be.
如果完全省略width
和/或height
,则默认为零,并且不会渲染图像.
If you omit width
and/or height
entirely, it defaults to zero and the image is not rendered.
这篇关于如何在SVG中不缩放图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文