color
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since Juli 2015.
Das color Attribut wird verwendet, um einen potenziellen indirekten Wert, currentColor, für die Attribute fill, stroke, stop-color, flood-color und lighting-color bereitzustellen.
Hinweis:
Als Präsentationsattribut hat color auch ein entsprechendes CSS-Eigenschaftsgegenstück: color. Wenn beide angegeben sind, hat die CSS-Eigenschaft Vorrang.
Technisch gesehen kann color auf jedes Element angewendet werden, aber es hat keine direkte Auswirkung auf SVG-Elemente.
Verwendungshinweise
| Wert |
<color>
| inherit
|
|---|---|
| Standardwert | Hängt vom Benutzeragenten ab |
| Animierbar | Ja |
Beispiel
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>
Spezifikationen
| Specification |
|---|
| CSS Color Module Level 4> # the-color-property> |
| Scalable Vector Graphics (SVG) 2> # ColorProperty> |
Browser-Kompatibilität
Siehe auch
- CSS
colorEigenschaft