<stop>
SVG 的 <stop> 元素定義了要在漸變中使用的顏色及其位置。此元素始終是 <linearGradient> 或 <radialGradient> 元素的子元素。
示例
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>
屬性
offset-
此屬性定義漸變停止點在漸變向量上的放置位置。值型別:<number>|<percentage>;預設值:
0;可動畫化:是 stop-color-
此屬性定義漸變停止點的顏色。它可以用作 CSS 屬性。值型別:
currentcolor|<color>|<icccolor>;預設值:black;可動畫化:是 stop-opacity-
此屬性定義漸變停止點的透明度。它可以用作 CSS 屬性。值型別:<opacity>;預設值:
1;可動畫化:是
使用上下文
規範
| 規範 |
|---|
| 可縮放向量圖形 (SVG) 2 # 漸變停止點 |
瀏覽器相容性
BCD 表格僅在瀏覽器中載入