Change svg image color with CSS
I have the following svg image in my html file:
<img class="svg" src="my-image-link.svg">
Now I'm trying to change the color using this css code:
.svg path {
fill: black;
}
However, nothing is changing. What is the correct way to change the color of the path of an SVG image using css? Thank!
+4
2 answers
You should use the built-in SVG, where the path element is inside the HTML, as opposed to referencing an external SVG.
: https://jsfiddle.net/fznuckb0/1/
.path-name {
fill: tomato;
fill-rule: evenodd;
}
+3