gpt4 book ai didi

html - 绝对定位的 DIV 内部的 SVG 绘图区域缩小

转载 作者:行者123 更新时间:2023-11-28 16:32:35 26 4
gpt4 key购买 nike

如何让蓝线连接内框的对 Angular 线(当前路径的宽度和高度都小于 10px)。

另一个问题是 SVG 路径似乎不是像素完美的。我通过使用 L 810 410 的路径数据手动增加了它的大小,并且该行向右下角移动。

<!DOCTYPE html>
<html>
<body>

<div style="margin-left: 100px; margin-top: 100px; width: 800px; height: 400px; border: 1px solid #ccc; position: relative;">
<div style="position: absolute; top: -10px; right: -10px; bottom: -10px; left: -10px; border: 1px solid #ccc; box-sizing: content-box;">
<svg style="width: 100%; height: 100%;">
<path d="M10 10 L 800 400" fill="none" stroke="blue" stroke-width="3" stroke-linecap="square"/>
</svg>
</div>

</div>

</body>
</html>

最佳答案

我对 SVG 不太了解,但我尝试用d="M10 10 L 810 410"解决了你的问题,现在它完全对 Angular 连接了。

希望这对您有所帮助。

关于html - 绝对定位的 DIV 内部的 SVG 绘图区域缩小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35089979/

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