How to style one particular SVG path in CSS?

前端 未结 3 502
北荒
北荒 2021-01-07 00:22

Is it possible to style differently a same SVG symbol with 2 distinct CSS classes. Like in this jsfiddle

3条回答
  •  离开以前
    2021-01-07 00:37

    You can achieve what you want, but without CSS. See this fiddle: http://jsfiddle.net/41e0f7z5/2/

    The trick is that you can set a fill attribute to the element. Then, your symbol is composed of a path and a group owning all the other pathes. This group has a fillattribute set to black. But, because the firt path has no fillattribute, it will inherit from the one.

    
    
      

提交回复
热议问题