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-Attribut: color. Wenn beide spezifiziert sind, hat die CSS-Eigenschaft Vorrang.
Technisch kann color auf jedes Element angewendet werden, hat jedoch keinen direkten Effekt auf SVG-Elemente.
Anwendungshinweise
| 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
Loading…
Siehe auch
- CSS
colorEigenschaft