如何在用作背景图像的外部SVG文件中设置路径元素的样式? [英] How to style path element in an external SVG file used as background image?

查看:72
本文介绍了如何在用作背景图像的外部SVG文件中设置路径元素的样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个div,在CSS中分配了背景图片.它是一个svg文件.即使有背景图片,我是否也可以访问更改其颜色的路径?

I have a div with an background image assigned in my CSS. Its an svg file. Is there any possibility I can access the paths to change their color, even though its a background image?

推荐答案

您可以添加

<?xml-stylesheet type="text/css" href="svg-stylesheet.css" ?>    

SVG文件顶部的

指令,然后在样式表中定义样式.

instruction at the top of your SVG file, then define the styles in the stylesheet.

请参见 http://www.w3.org/TR/SVG/styling .html#ReferencingExternalStyleSheets .

这篇关于如何在用作背景图像的外部SVG文件中设置路径元素的样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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