You can’t change the colours of an SVG that’s included via <img>
or background-image
. You’ll need to include it inline in your page. You can then change the colours using the fill
and stroke
properties.
.square {
fill: red;
stroke: blue;
stroke-width: 4;
}
<div>
<p>Hello world</p>
<svg>
<rect class="square" x="5" y="5" width="100" height="100"/>
</svg>
</div>
solved CSS and creating border of svg figure