使用语境
属性
offset
-
此属性定义渐变停止点在渐变向量上的位置。值类型:<number> | <percentage>;默认值:
0
;可动画:是 stop-color
-
此属性定义渐变停止点的颜色。它可以作为 CSS 属性使用。值类型:<color>;默认值:
black
;可动画:是 stop-opacity
-
此属性定义渐变停止点的透明度。它可以作为 CSS 属性使用。值类型:<opacity-value>;默认值:
1
;可动画:是
DOM 接口
此元素实现了 SVGStopElement
接口。
示例
html
<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>
规范
规范 |
---|
Scalable Vector Graphics (SVG) 2 # StopElement |
浏览器兼容性
加载中…