How to change color of SVG image using CSS (jQuery SVG image replacement)?

后端 未结 17 1950
死守一世寂寞
死守一世寂寞 2020-11-21 17:36

This is a self Q&A of a handy piece of code I came up with.

Currently, there isn\'t an easy way to embed an SVG image and then have access to the SVG elements vi

17条回答
  •  迷失自我
    2020-11-21 18:12

    I realize you're wanting to accomplish this with CSS, but just a reminder in case it's a small, simple image - you can always pop it open in Notepad++ and change the path/whateverelement's fill:

    
    

    It could save a ton of ugly script. Sorry if it's off-base, but sometimes the simple solutions can be overlooked.

    ...even swapping multiple svg images might be smaller in size than some of the code snippets for this question.

提交回复
热议问题