简体   繁体   English

在SVG中使用图标

[英]Use icons inside SVG

I have a PNG image, which I use in my HTML as background-image for <i> elements. 我有一个PNG图片,在我的HTML中用作<i>元素的背景图片。 I need to use this icon inside the SVG. 我需要在SVG中使用此图标。 Putting <i> inside of <foreignObject> renders the icon, but causes lots of other problems. <i>放在<foreignObject>会呈现图标,但是会引起许多其他问题。

Is there any way to get the icon effect inside SVG without using HTML tags? 有没有办法在不使用HTML标签的情况下在SVG中获得图标效果?

SVG has an <image> tag very much like the one in HTML: SVG具有<image>标记,非常类似于HTML中的标记:

<image xlink:href="firefox.jpg" x="0" y="0" height="50px" width="50px"></image>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM