当我对 SVG 文件中的图像使用preserveAspectRatio=none 时,它似乎在 Google Chrome 中不起作用。
SVG 不会根据图像宽度和高度进行缩放。
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg id="test"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 1024 768">
<defs>
</defs>
<image x="288" y="140" width="368" height="160" xlink:href="image.svg" preserveAspectRatio="none" />
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg id="test"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 1024 768">
<defs>
</defs>
<image x="288" y="140" width="368" height="160" xlink:href="image.svg" preserveAspectRatio="none" />
</svg>
在 IE9、最新的 Opera 和 FF 中都可以使用!
如果应该包含的图像没有属性preserveAspectRatio=none,它似乎不起作用。
我不能假设每个 SVG 都有这个属性。所以我需要知道如何覆盖这样的属性,以防 SVG 嵌入“图像”标签。
http://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute http://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute
请尝试“推迟”。
但我认为chrome不支持这个值。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)