是用于SVG的CSS“标准” CSS? [英] Is CSS for SVG "standard" CSS?
问题描述
我想使用外部样式表为一些SVG精灵设计样式,详情请参阅此 Sitepoint教程
I'd like to style some SVG sprites using an external stylesheet, as detailed in this Sitepoint tutorial and W3C's Styling with SVG.
但是,CSS并不是非常,标准的:
However, the CSS isn't very, er, standard:
rect {
fill: red;
stroke: blue;
stroke-width: 3
}
有什么优点? / p>
What gives?
推荐答案
CSS是SVG标准CSS吗?
Is CSS for SVG "standard" CSS?
不,它不是。它使用CSS 语言,但它不在CSS属性规范中。它只是SVG规范的一部分。它非常类似于使用非标准的供应商扩展,因为虽然前缀在CSS语法中定义,前缀属性实际上不验证为CSS,因为它们是非标准的。
No, it is not. It makes use of the CSS language, but it is not in the CSS property specification. It's only part of the SVG specification. It's quite similar to using non-standard vendor extensions, in that while prefixes are defined in the CSS grammar, prefixed properties don't actually validate as CSS solely because they're non-standard.
在验证代码时,应该选择SVG验证配置文件,但它似乎不起作用;它只发出与根据CSS规范验证的错误一样多的错误。在这种情况下,那么它可能是一个验证器错误。
You're supposed to choose the SVG validation profile when validating your code, but it doesn't appear to work; it spits just as many errors as validating according to the CSS spec would. In that case, then it's probably a validator bug.
这篇关于是用于SVG的CSS“标准” CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!