Skip to main content
The 2024 Developer Survey results are live! See the results

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 5
    Welcome to StackOverflow, Neto. This looks like a good answer. Thanks for helping.
    – srm
    Commented Jun 10, 2020 at 18:07
  • 3
    -- is the syntax for CSS Variables, and being newer, a compatibility note is worth adding here, even if the concern will fade over time: CSS Variables are supported by everything except old IE and Opera Mini. Opera Mini is an important concern given its Developing World popularity - you should not use this technique to inform the user about something important, since the 100mil+ Opera Mini users will not be able to see it. caniuse.com/#feat=css-variables Commented Aug 25, 2020 at 20:20
  • If the svg is replaced, the function is lost. Commented Nov 2, 2021 at 2:44
  • Thanks, in my case I couldn't use another solution. Commented Jul 8, 2022 at 14:51
  • In 2024, the best answer. Use with the CSS property names for SVG's, e.g. stroke (a color), stroke-width (a number relative to the svg viewbox size), fill (a color) Commented Mar 14 at 19:03