JQuery修改SVG标签颜色无效,行内CSS既然不是优先级最高?

请问有人遇到过此类问题吗?我想用JQ动态修改svg标签的颜色,结果其它浏览器全部都支持,而火狐既然抽风了、、很确定样式已经加上了,但它始终只显示默认的CSS颜色,动态添加的是行内样式都无效,我用的是Iconfont提供的图库,默认给svg加了fill: currentColor;属性,然后通过color来修改其图标颜色。

JQuery添加的:style="color: rgb(204, 204, 204);无效、、、求救

阅读 5.9k
2 个回答

唯独火狐有问题的话,可以直接给颜色值试试:#f1f1f1类似于这样。

W3C文档如下描述,不知是否能解答疑问
Some styling properties can be specified not only in style sheets and ‘style’ attributes, but also in presentation attributes. These are attributes whose name matches (or is similar to) a given CSS property and whose value is parsed as a value of that property. Presentation attributes contribute to the author level of the cascade, following all other author-level style sheets, and have specificity 0.
Presentation attributes
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题