does anyone knows if it is possible to change the color (the stroke and fill attributes) of a SVG illustration used as a background with background-image: url() directly via CSS?

Thank you

1 Answer 1


Yes, you can absolutely do this with SVG, as long as you're using inline SVG code, which you'll need a program like Adobe Illustrator to produce. You may be able to use an online tool (like this one) but I haven't tried that.

Chris Coyier of CSSTricks.com did an excellent write up of this.

Fork his SVG codepen and play around with it to get a feel for how it works.

Good luck!

  • Question is asking for control color of a SVG used as background image. This answer refers to a SVG image (not as background)
    – aitor
    Commented May 25, 2022 at 5:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.