使用svg组件<defs>
和<use>
适用于圆和椭圆,但是使用它们创建多个<polyline>
时遇到了麻烦。
这是我的代码:
svg width="900" height="900"
defs
g id="POL"
<!--circle style="fill: inherit;" r="10"/-->
<polyline style="fill:black;stroke:red;stroke-width:1">
<line style="stroke:black;stroke-width:1.5"/>
g
defs
<use points="0,10 25,10 35,20 5 25" xlink:href="#POL" />
<use points="12,10 20,30 15,35 5 25" href="#bateau"/>
<use points="12,4 10,28 10,30" href="#POL" style="fill:red;">
svg
答案 0 :(得分:0)
points
is not a valid attribute for a use
element,但是width
,height
x
和y
是。这就是为什么可以通过将某些rect
和circle
属性添加到use
元素而不是polyline
属性的情况下对其进行更改的原因(请注意,如果您尝试更改{{1 }}的圆形,也无效。
(似乎您正在尝试将def / use用作样式抽象。这就是CSS的目的。)