SVG无法修改图标颜色问题

<svg t="1656491136549" class="icon" viewBox="0 0 1024 1024" version="1.1" p-id="1925" width="200" height="200"><path  fill="#cccccc" d="M772.096 243.712q17.408-17.408 39.424-22.528t40.96 2.048 31.744 26.624 12.8 50.176l0 461.824q0 27.648-9.216 52.224t-25.6 43.008-38.912 28.672-49.152 10.24l-490.496 0q-26.624 0-43.52-13.312t-23.04-32.768-1.024-41.472 22.528-39.424q25.6-25.6 70.144-69.12t98.304-96.256 110.592-109.056 107.52-105.984 90.112-88.576 56.832-56.32z" p-id="1926"></path></svg>

将代码中的 fill 改为

fill="currentColor"

即可在外部通过指定样式的color改变图标颜色

猜你喜欢

转载自blog.csdn.net/weixin_34403976/article/details/125526687