gpt4 book ai didi

css - SVG 线条不可见

转载 作者:行者123 更新时间:2023-11-28 10:36:16 25 4
gpt4 key购买 nike

Fiddle here

<svg version="1.1">
<line x1="492" y1="503" x2="717" y2="576" stroke="#4A4A4A" stroke-width="2"></line>
<line x1="500" y1="400" x2="600" y2="400" stroke="#4A4A4A" stroke-width="2"></line>
<line x1="604.5" y1="539.5" x2="587.5" y2="542.5" stroke="red" stroke-width="2"></line>
<line x1="604.5" y1="539.5" x2="592.5" y2="527.5" stroke="red" stroke-width="2"></line>
</svg>

如果我给 x1="0"和 y1="0"那么这些线就会变得可见。为什么在上面的代码中看不到该行?

最佳答案

将宽度和高度添加到 svg 元素(确保它足够大以覆盖您的绘图)

<svg version="1.1" width="1000" height="1000">
<line x1="492" y1="503" x2="717" y2="576" stroke="#4A4A4A" stroke-width="2"></line>
<line x1="500" y1="400" x2="600" y2="400" stroke="#4A4A4A" stroke-width="2"></line>
<line x1="604.5" y1="539.5" x2="587.5" y2="542.5" stroke="red" stroke-width="2"></line>
<line x1="604.5" y1="539.5" x2="592.5" y2="527.5" stroke="red" stroke-width="2"></line>
</svg>

fiddle :https://jsfiddle.net/af5g1d3q/

关于css - SVG 线条不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37352853/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com