.svg{ fill: white; } ...">

Add svg to webpage?

How to add svg to my webpage and change its color via css?

I tried:

<img src="my.svg" class="svg"/> .svg{ fill: white; } 

But no luck.

Only CSS solutions, and I don't need backups that only support new browsers.

+5
source share
1 answer

This will not work. You can change the fill color if you directly enable svg, i.e.:

HTML:

 <p>Some other webpage content</p> <svg class="my-svg"> <g> <path fill="..."></path> <path fill="..."></path> </g> </svg> <p>Some other webpage content</p> 

CSS

 .my-svg *{ fill:white; } 

So, you check web my.svg and copy its contents to the landing page. Then you can style it.

+1
source

All Articles