Re: [svgwg] Suggestion: explicitly mention if CSS variables are supported inside presentation attributes (#987)

> The closest I found was [Attribute syntax](https://svgwg.org/svg2-draft/types.html#presentation-attribute-css-value), where it says (some) values are parsed according to the CSS grammar. It even provides an example using CSS comments inside a value. But there is no mention of CSS variables.

I agree it's not always clear how things work. But specifically mentioning `var()` isn't especially useful either - there are many different ways that values in CSS can be declared.

If you read the part about [presentation attributes](https://svgwg.org/svg2-draft/styling.html#TermPresentationAttribute), it says:
> These are attributes whose name matches (or is similar to) a given CSS property and whose value is parsed as a value of that property.

Therefore if a function (like `var()` or `attr()` or `calc()` or `env()` or `sibling-index()` or anything else) would be valid in the property, it's valid in the presentation attribute. `fill="foo"` is the same as `style="fill: foo"`. (Except in the exceptions listed in the table there, because SVG likes to sprinkle fun surprises like that into our lives. 😆)

-- 
GitHub Notification of comment by AtkinsSJ
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/987#issuecomment-3095945786 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 21 July 2025 09:44:00 UTC