<分区>
我的 svgs 在 css 中指定如下:
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="18" height="15" viewBox="0 0 18 15"><g fill="none" fill-rule="evenodd" stroke="#00174a"><path d="M11 1l7 6.533L11.07 14M17.5 7.5H.5"/></g></svg>')
这适用于所有浏览器,但自 chrome 72 起,此功能不再适用于 chrome。我在 background
属性中找不到任何关于 data:image
前缀的可靠文档。或来自谷歌的有关此更改的更新。
我知道我可以指定一个 svg 的路径,但我正在使用这种技术来重现具有不同颜色的 svg,这是我需要实现的方法。