<lineargradient>
<radialgradient>
<stop>
<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>
<linearGradient>
element lets authors define linear gradients to apply to other SVG elements.
<svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<linearGradient id="myGradient" gradientTransform="rotate(90)">
<stop offset="5%" stop-color="gold" />
<stop offset="95%" stop-color="red" />
</linearGradient>
</defs>
<!-- using my linear gradient -->
<circle cx="5" cy="5" r="4" fill="url('#myGradient')" />
</svg>
gradientUnits
This attribute defines the coordinate system for attributes
x1
,
x2
,
y1
,
y2
Value type
:
userSpaceOnUse
|
objectBoundingBox
;
默认值
:
objectBoundingBox
;
Animatable
:
yes
gradientTransform
This attribute provides additional transformation to the gradient coordinate system. Value type : <transform-list> ; 默认值 : identity transform ; Animatable : yes
href
This attribute defines a reference to another
<linearGradient>
element that will be used as a template.
Value type
:
<URL>
;
默认值
: none;
Animatable
:
yes
spreadMethod
This attribute indicates how the gradient behaves if it starts or ends inside the bounds of the shape containing the gradient.
Value type
:
pad
|
reflect
|
repeat
;
默认值
:
pad
;
Animatable
:
yes
x1
This attribute defines the x coordinate of the starting point of the vector gradient along which the linear gradient is drawn.
Value type
:
<length-percentage>
|
<number>
;
默认值
:
0%
;
Animatable
:
yes
x2
This attribute defines the x coordinate of the ending point of the vector gradient along which the linear gradient is drawn.
Value type
:
<length-percentage>
|
<number>
;
默认值
:
100%
;
Animatable
:
yes
xlink:href
Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the 兼容性表格 at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
An <IRI> reference to another
<linearGradient>
element that will be used as a template.
Value type
:
<IRI>
;
默认值
: none;
Animatable
:
yes
y1
This attribute defines the y coordinate of the starting point of the vector gradient along which the linear gradient is drawn.
Value type
:
<length-percentage>
|
<number>
;
默认值
:
0%
;
Animatable
:
yes
y2
This attribute defines the y coordinate of the ending point of the vector gradient along which the linear gradient is drawn.
Value type
:
<length-percentage>
|
<number>
;
默认值
:
0%
;
Animatable
:
yes
Most notably:
id
class
,
style
Global event attributes , Document element event attributes
Most notably:
clip-path
,
clip-rule
,
color
,
color-interpolation
,
color-rendering
,
cursor
,
display
,
fill
,
fill-opacity
,
fill-rule
,
filter
,
mask
,
opacity
,
pointer-events
,
shape-rendering
,
stroke
,
stroke-dasharray
,
stroke-dashoffset
,
stroke-linecap
,
stroke-linejoin
,
stroke-miterlimit
,
stroke-opacity
,
stroke-width
,
transform
,
vector-effect
,
visibility
xlink:href
,
xlink:title
| 类别 | Gradient element |
|---|---|
| 准许内容 |
Any number of the following elements, in any order:
Descriptive elements
<animate>
,
<animateTransform>
,
<set>
,
<stop>
|
| 规范 |
|---|
|
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
(SVG)
# LinearGradients |
BCD tables only load in the browser
最后修改: , 由 MDN 贡献者