文本 text 元素

使用 fill 属性设置 text 字体颜色。

1
<text fill="yellow" >hello</text>

使用 x 、y 属性设置 text 位置。

1
<text x="20" y="30"  >hello</text>

使用 text-anchor 属性设置文本对齐方式,属性值有 left 、middle、right。

1
<text text-anchor="middle" >hello</text>

矩形 rect 元素

设置元素宽高

1
<rect width="30" height="20"  ></rect>

设置笔画颜色 stroke

1
<rect stroke="black"  ></rect>

设置笔画宽度 stroke-width

1
<rect stroke-width="1"  ></rect>

设置填充颜色

1
<rect style="fill:red"  ></rect>