The color
attribute is used to provide a potential indirect value (currentColor
) for the fill
, stroke
, stop-color
, flood-color
and lighting-color
attributes.
As a presentation attribute, it also can be used as a property directly inside a CSS stylesheet, see css color
for further information.
Categories | Presentation attribute |
---|---|
Value | <color> | inherit |
Animatable | Yes |
Normative document | SVG 1.1 (2nd Edition) |
<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>
The following elements can use the color
attribute
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | ? | ? | ? | ? | ? | ? |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | ? | ? | ? | ? | ? | ? | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/color