如何在SVG中绘制垂直线

约翰切斯

我试图用SVG画一条垂直线。

<style>
  svg#chart {
    background: lightgray;
  }
  #chart line {stroke: #555555; stroke-width:1}
</style>
<svg id="chart" width="300" height="225">
  <line x="20" y1="20" x2="20" y2="130"></line>
</svg>

在此处输入图片说明

假设“ x”和“ x2”相同,则我希望这条线是完全垂直的。对于这种类型的编程,我还很陌生,所以我很可能会漏掉一些非常明显的东西,但是这不是我所期望的。

我如何使这条线垂直?

罗伯特·朗森

您想要x1,而不是x

<style>
  svg#chart {
    background: lightgray;
  }
  #chart line {stroke: #555555; stroke-width:1}
</style>
<svg id="chart" width="300" height="225">
  <line x1="20" y1="20" x2="20" y2="130"></line>
</svg>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章