SVG presentation attributes let you style an element — its fill, stroke, font, opacity, and transform — directly in markup. Each is shorthand for a CSS property of the same name, but with the lowest priority in the cascade. This is a searchable offline reference.
How it works
Each attribute lists four facts that decide how it behaves:
- Value type — a
paint(color orurl(#id)), alength/number, atokenfrom an enumerated set, or astring. - Default — the value applied when the attribute is absent.
- CSS equivalent — almost all presentation attributes are also CSS properties. Setting it in CSS lets you theme, hover, and override; the attribute is a low-specificity fallback.
- Applies to — paint attributes apply to shapes and text; font/text attributes apply to text content elements.
Because presentation attributes sit below every CSS rule in the cascade, a stylesheet always wins. Use the attribute for static inline styling and CSS when you need theming or interaction.
Example
<circle cx="50" cy="50" r="40"
fill="none" stroke="teal" stroke-width="6"
stroke-dasharray="10 4" stroke-linecap="round" />
stroke-dasharray="10 4" draws a 10-unit dash then a 4-unit gap, repeating; the
same effect in CSS is stroke-dasharray: 10 4.
Notes
- Geometry attributes (
x,cx,r,d,points) are not presentation attributes — they must stay in markup and have no CSS equivalent (SVG 2 adds some as CSS, but support is uneven). fillandstrokeaccept a paint: a color,none,currentColor, or aurl(#id)reference to a gradient or pattern.- This reference covers the common presentation attributes, not the entire SVG 2 specification.