<分区>
出于某种原因,在 CSS 中设置 color: #ffffff
不适用于我的 SVG。
下面的代码看起来如何
我希望它看起来如何
有趣的是,如果我在 SVG 本身中将 currentColor
替换为#ffffff,它会起作用,但在我的 CSS 中设置它不会执行任何操作。我还尝试在 HTML 中内联设置它 (style="color:#ffffff"
),并设置 stroke: #ffffff
,但这也没有做任何事情。
我没有想法,所以如果有人知道如何做到这一点,以及为什么在 css 中设置它不起作用,请告诉我。
这是我的代码:
下载.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>
我的头像:
<button type='button' class='btn btn-primary' on:click={ExportXlsx}>
Last ned
<img class='test' alt='download' src='/images/download.svg' />
</button>
我的CSS:
.test{
color: #ffffff !important;
}