Why is the CSS color: #ffffff
not applying to my SVG?
This is how it currently looks:
https://i.sstatic.net/qh7ng.png
This is how I want it to look:
https://i.sstatic.net/6tLo5.png
Surprisingly, changing currentColor
to #ffffff in the SVG itself works, but setting it in the CSS has no effect. I also attempted inline styling in the HTML (style="color:#ffffff"
), and using stroke: #ffffff
, both without success.
I've run out of options, so if anyone has a solution for this issue and understands why setting it in CSS is ineffective, please share your insights.
Here's my code snippet:
download.svg:
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="feather feather-download"
>
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
<polyline points="7 10 12 15 17 10"></polyline>
<line x1="12" y1="15" x2="12" y2="3"></line>
</svg>
My image tag:
<button type='button' class='btn btn-primary' on:click={ExportXlsx}>
Download
<img class='test' alt='download' src='/images/download.svg' />
</button>
My CSS style:
.test{
color: #ffffff !important;
}