How to style SVG element?

前端 未结 4 803
半阙折子戏
半阙折子戏 2021-02-02 05:58

I have some SVG elements grouped together in a element. I just want to style that element to show grouping of elements. Like I want

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-02 06:24

    You cannot add style to an SVG element. Its only purpose is to group children. That means, too, that style attributes you give to it are given down to its children, so a fill="green" on the means an automatic fill="green" on its child (as long as it has no own fill specification).

    Your only option is to add a new to the SVG and place it accordingly to match the children's dimensions.

提交回复
热议问题