是否可以将 SVG 预定义的形状line
更改为具有属性和 CSS 的圆形形状(而不是circle
元素(?我的意思是我们不会将line
标签更改为circle
标签,而只是更改一些样式和属性以使其看起来像一个圆形。
我尝试了stroke-linecap
属性,但似乎我错过了一些东西。
<!DOCTYPE html>
<html>
<body>
<svg height="210" width="500">
<line x1="0" y1="0" x2="30" y2="0" stroke-linecap="round" style="stroke:rgb(255,0,0);stroke-width:40" />
Sorry, your browser does not support inline SVG.
</svg>
</body>
</html>
你能告诉我怎么做吗?
提前谢谢。
https://codepen.io/a10k/pen/ModQzq
<svg height="210" width="500">
<line x1="100" y1="100" x2="100" y2="100" stroke-linecap="round" style="stroke:rgb(255,0,0);stroke-width:40" />
Sorry, your browser does not support inline SVG.
</svg>
你实现了你想要的,你只是把线放在一个角落里,这样它看起来就不像一个圆圈,因为它被修剪了。