color
color 屬性用於為 fill、stroke、stop-color、flood-color 和 lighting-color 屬性提供一個潛在的間接值:currentColor。
注意: 作為演示屬性,color 還有一個對應的 CSS 屬性:color。當兩者都被指定時,CSS 屬性具有優先權。
從技術上講,color 可以應用於任何元素,但它對 SVG 元素沒有直接影響。
用法說明
| 值 |
<color> | inherit |
|---|---|
| 預設值 | 取決於使用者代理 |
| 可動畫的 | 是 |
示例
html
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<g color="green">
<rect width="50" height="50" fill="currentColor" />
<circle
r="25"
cx="70"
cy="70"
stroke="currentColor"
fill="none"
stroke-width="5" />
</g>
</svg>
規範
| 規範 |
|---|
| CSS 顏色模組第四版 # the-color-property |
| Scalable Vector Graphics (SVG) 2 # ColorProperty |
瀏覽器相容性
載入中…
另見
- CSS
color屬性