我想在行末端添加箭头

发布于 2025-01-17 23:36:59 字数 514 浏览 1 评论 0原文

我尝试了这个代码

<svg>
<g id="vc">
<defs>
    <marker id="arrowhead_bc" markerWidth="10" markerHeight="7" 
    refX="0" refY="3.5">
      <polygon points="0 0, 10 3.5, 0 7" />
    </marker>
  </defs>
  <rect x='.5' y='0' width='120' height='.5' style="fill:red;stroke:red" marker-end="url(arrowhead_bc)"/>
</g>
</svg>

我想在线路的末端添加一个箭头,以便我可以使用一个一个者元素?

I tried this code

<svg>
<g id="vc">
<defs>
    <marker id="arrowhead_bc" markerWidth="10" markerHeight="7" 
    refX="0" refY="3.5">
      <polygon points="0 0, 10 3.5, 0 7" />
    </marker>
  </defs>
  <rect x='.5' y='0' width='120' height='.5' style="fill:red;stroke:red" marker-end="url(arrowhead_bc)"/>
</g>
</svg>

I want to add an arrow at the end of the line with angle position so that I can use a rect element?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

執念 2025-01-24 23:36:59
  • 如果要绘制一条线,请使用行元素。
  • 您缺少URL中的#字符
<svg>
<g id="vc">
<defs>
    <marker id="arrowhead_bc" markerWidth="10" markerHeight="7" 
    refX="0" refY="3.5">
      <polygon points="0 0, 10 3.5, 0 7" />
    </marker>
  </defs>
  <line x1='0.5' y1='3.5' x2='120' y2='3.5' style="fill:red;stroke:red" marker-end="url(#arrowhead_bc)"/>
</g>
</svg>

  • If you want to draw a line - use a line element.
  • You're missing a # character in your url

<svg>
<g id="vc">
<defs>
    <marker id="arrowhead_bc" markerWidth="10" markerHeight="7" 
    refX="0" refY="3.5">
      <polygon points="0 0, 10 3.5, 0 7" />
    </marker>
  </defs>
  <line x1='0.5' y1='3.5' x2='120' y2='3.5' style="fill:red;stroke:red" marker-end="url(#arrowhead_bc)"/>
</g>
</svg>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文