SVG使用不适用于Safari [英] SVG use not working in Safari

查看:568
本文介绍了SVG使用不适用于Safari的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 html 文件中使用这个svg标签。它在Chrome中完美运行,但在Safari中不显示图标

23viewBox =0 0 25 23>
< use href =./ icons.svg#helemet>< / use>
< / svg>

任何知道为什么?

解决方案

Safari不支持href,您需要使用xlink:href。

href是即将推出的SVG 2规范的一项新功能。 xlink:href是SVG 1.1版本。

Chrome,Firefox和Edge支持xlink:href和href。


Im using this svg tag in my html file. It works perfectly in Chrome, but in safari the icon doesn't appear

<svg width="25" height="23" viewBox="0 0 25 23">
       <use href="./icons.svg#helemet"></use>
 </svg>

any know why?

解决方案

Safari doesn't support href yet, you need to use xlink:href instead.

href is a new feature of the upcoming SVG 2 specification. xlink:href is the SVG 1.1 version.

Chrome, Firefox and Edge support both xlink:href and href.

这篇关于SVG使用不适用于Safari的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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