color
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since juillet 2015.
L'attribut color est utilisé pour définir indirectement une valeur potentielle (currentColor) pour les attributs fill, stroke, stop-color, flood-color et lighting-color.
Note : color étant un attribut de présentation, il peut être utilisé comme propriété CSS. Voir CSS color pour plus d'informations.
Contexte d'utilisation
| Catégories | Attribut de présentation |
|---|---|
| Valeur | <color> | inherit |
| Animation | Yes |
| Document normatif | SVG 1.1 (2nd Edition) |
Exemple
html
<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg" version="1.1">
<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>
Éléments
Les éléments suivants peuvent utiliser l'attribut color:
Compatibilité des navigateurs
Loading…