<feBlend>
<feColorMatrix>
<feComponentTransfer>
<feComposite>
<feConvolveMatrix>
<feDiffuseLighting>
<feDisplacementMap>
<feDistantLight>
<feFlood>
<feFuncA>
<feFuncB>
<feFuncG>
<feFuncR>
<feGaussianBlur>
<feImage>
<feMerge>
<feMergeNode>
<feMorphology>
<feOffset>
<fePointLight>
<feSpecularLighting>
<feSpotLight>
<feTile>
<feTurbulence>
<filter>
<font>
<font-face>
<font-face-format>
<font-face-name>
<font-face-src>
<font-face-uri>
<foreignObject>
fill
attribute has two different meanings. For shapes and text it's a presentation attribute that defines the color (
or any SVG paint servers like gradients or patterns
) used to paint the element; for animation it defines the final state of the animation.
You can use this attribute with the following SVG elements:
For animation, these elements are using this attribute:
<animate>
,
<animateColor>
,
<animateMotion>
,
<animateTransform>
,和
<set>
.
<svg viewBox="0 0 300 100" xmlns="http://www.w3.org/2000/svg">
<!-- Simple color fill -->
<circle cx="50" cy="50" r="40" fill="pink" />
<!-- Fill circle with a gradient -->
<defs>
<radialGradient id="myGradient">
<stop offset="0%" stop-color="pink" />
<stop offset="100%" stop-color="black" />
</radialGradient>
</defs>
<circle cx="150" cy="50" r="40" fill="url(#myGradient)" />
<!--
Keeping the final state of an animated circle
which is a circle with a radius of 40.
-->
<circle cx="250" cy="50" r="20">
<animate attributeType="XML"
attributeName="r"
from="0" to="40" dur="5s"
fill="freeze" />
</circle>
</svg>
警告:
As of SVG2
<altGlyph>
is deprecated and shouldn't be used.
For
<altGlyph>
,
fill
is a presentation attribute that defines the color of the glyph.
| 值 | <paint> |
|---|---|
| 默认值 |
black
|
| Animatable | Yes |
注意:
As a presentation attribute
fill
can be used as a CSS property.
For
<animate>
,
fill
defines the final state of the animation.
| 值 |
freeze
(
Keep the state of the last animation frame
) |
remove
(
Keep the state of the first animation frame
)
|
|---|---|
| 默认值 |
remove
|
| Animatable | No |
警告:
As of SVG Animation 2
<animateColor>
is deprecated and shouldn't be used. Use
<animate>
代替。
For
<animateColor>
,
fill
defines the final state of the animation.
| 值 |
freeze
(
Keep the state of the last animation frame
) |
remove
(
Keep the state of the first animation frame
)
|
|---|---|
| 默认值 |
remove
|
| Animatable | No |
For
<animateMotion>
,
fill
defines the final state of the animation.
| 值 |
freeze
(
Keep the state of the last animation frame
) |
remove
(
Keep the state of the first animation frame
)
|
|---|---|
| 默认值 |
remove
|
| Animatable | No |
For
<animateTransform>
,
fill
defines the final state of the animation.
| 值 |
freeze
(
Keep the state of the last animation frame
) |
remove
(
Keep the state of the first animation frame
)
|
|---|---|
| 默认值 |
remove
|
| Animatable | No |
For
<circle>
,
fill
is a presentation attribute that defines the color of the circle.
| 值 | <paint> |
|---|---|
| 默认值 |
black
|
| Animatable | Yes |
注意:
As a presentation attribute
fill
can be used as a CSS property.
For
<ellipse>
,
fill
is a presentation attribute that defines the color of the ellipse.
| 值 | <paint> |
|---|---|
| 默认值 |
black
|
| Animatable | Yes |
注意:
As a presentation attribute
fill
can be used as a CSS property.
For
<path>
,
fill
is a presentation attribute that defines the color of the interior of the shape. (
Interior is define by the
fill-rule
属性
)
| 值 | <paint> |
|---|---|
| 默认值 |
black
|
| Animatable | Yes |
注意:
As a presentation attribute
fill
can be used as a CSS property.
For
<polygon>
,
fill
is a presentation attribute that defines the color of the interior of the shape. (
Interior is define by the
fill-rule
属性
)
| 值 | <paint> |
|---|---|
| 默认值 |
black
|
| Animatable | Yes |
注意:
As a presentation attribute
fill
can be used as a CSS property.
For
<polyline>
,
fill
is a presentation attribute that defines the color of the interior of the shape. (
Interior is define by the
fill-rule
属性
)
| 值 | <paint> |
|---|---|
| 默认值 |
black
|
| Animatable | Yes |
注意:
As a presentation attribute
fill
can be used as a CSS property.
For
<rect>
,
fill
is a presentation attribute that defines the color of the rectangle.
| 值 | <paint> |
|---|---|
| 默认值 |
black
|
| Animatable | Yes |
注意:
As a presentation attribute
fill
can be used as a CSS property.
For
<set>
,
fill
defines the final state of the animation.
| 值 |
freeze
(
Keep the state of the last animation frame
) |
remove
(
Keep the state of the first animation frame
)
|
|---|---|
| 默认值 |
remove
|
| Animatable | No |
For
<text>
,
fill
is a presentation attribute that defines what the color of the text.
| 值 | <paint> |
|---|---|
| 默认值 |
black
|
| Animatable | Yes |
注意:
As a presentation attribute
fill
can be used as a CSS property.
For
<textPath>
,
fill
is a presentation attribute that defines the color of the text.
| 值 | <paint> |
|---|---|
| 默认值 |
black
|
| Animatable | Yes |
注意:
As a presentation attribute
fill
can be used as a CSS property.
警告:
As of SVG2
<tref>
is deprecated and shouldn't be used.
For
<tref>
,
fill
is a presentation attribute that defines the color of the text.
| 值 | <paint> |
|---|---|
| 默认值 |
black
|
| Animatable | Yes |
注意:
As a presentation attribute
fill
can be used as a CSS property.
For
<tspan>
,
fill
is a presentation attribute that defines the color of the text.
| 值 | <paint> |
|---|---|
| 默认值 |
black
|
| Animatable | Yes |
注意:
As a presentation attribute
fill
can be used as a CSS property.
| 规范 | 状态 | 注释 |
|---|---|---|
|
SVG Animations Level 2
The definition of 'transform' in that specification. |
编者草案 | Definition for animations |
|
Scalable Vector Graphics (SVG) 2
The definition of 'fill' in that specification. |
候选推荐 |
Definition for shapes and texts.
添加
context-fill
and
context-stroke
.
|
|
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'fill' in that specification. |
推荐 | Initial definition for animations |
|
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'fill' in that specification. |
推荐 | Initial definition for shapes and texts |
BCD tables only load in the browser
注意:
For information on using the
context-fill
(和
context-stroke
) values from HTML documents, see the documentation for the non-standard
-moz-context-properties
特性。
最后修改: , 由 MDN 贡献者