How to change the color of an svg element?

I want to use this technique and change the SVG color, but so far I haven’t been able to do so. I put this in the CSS, but my image is always black, no matter what.

My code:

.change-my-color {
  fill: green;
}
<svg>
    <image class="change-my-color" xlink:href="https://svgur.com/i/AFM.svg" width="96" height="96" src="https://stackoverflow.com/questions/22252472/ppngfallback.png" />
</svg>

33 s
33

Leave a Comment