SVG Properties/Presentation 属性和样式属性
SVG Properties/Presentation attributes and Style-attribute
您可以在元素中声明Properties/Presentation attributes
:
<rect width="50" height="50" fill="blue" />
或者您可以在 style
属性中声明它们,如果元素支持的话:
<rect width="50" height="50" style="fill:blue;" />
然而,有些元素不支持 style
属性,但它们支持某些 Properties/Presentation attributes
。一个例子是 Animate-element.
为什么不是所有支持 Properties/Presentation attributes
的元素都不支持 style
属性?
表示属性包含在 animate
元素的可能属性列表中。但是如果你查看规格 definition of presentation attributes 你会读到:
Note that although any property may be specified on any element, not
all properties will apply to (affect the rendering of) a given
element. The definition of each property states to what set of
elements it applies.
因此,例如,如果您选中 what elements the alignment-baseline
applies to,您将不会看到列出的 animate
元素。
在 animate
元素的可能表示属性列表中,还有 color-interpolation
、which does include animate
between the list of elements that it applies to。但是没有类似或者对应的CSS属性,是吗?
您可以在元素中声明Properties/Presentation attributes
:
<rect width="50" height="50" fill="blue" />
或者您可以在 style
属性中声明它们,如果元素支持的话:
<rect width="50" height="50" style="fill:blue;" />
然而,有些元素不支持 style
属性,但它们支持某些 Properties/Presentation attributes
。一个例子是 Animate-element.
为什么不是所有支持 Properties/Presentation attributes
的元素都不支持 style
属性?
表示属性包含在 animate
元素的可能属性列表中。但是如果你查看规格 definition of presentation attributes 你会读到:
Note that although any property may be specified on any element, not all properties will apply to (affect the rendering of) a given element. The definition of each property states to what set of elements it applies.
因此,例如,如果您选中 what elements the alignment-baseline
applies to,您将不会看到列出的 animate
元素。
在 animate
元素的可能表示属性列表中,还有 color-interpolation
、which does include animate
between the list of elements that it applies to。但是没有类似或者对应的CSS属性,是吗?