gpt4 book ai didi

html - 如何让 SVG 多段线以百分比表示?

转载 作者:可可西里 更新时间:2023-11-01 13:22:45 32 4
gpt4 key购买 nike

我希望能够创建 SVG 路径,其中 0,0 位于屏幕的左上角,100,100 位于右下角。

这是我目前所拥有的,它只是在中心创建了图表,而不是我想要的。

* {
margin: 0;
padding: 0;
}

html,
body,
svg {
overflow-x: hidden;
overflow-y: hidden;
width: 100%;
height: 100%;
}

polyline {
fill: none;
stroke: gray;
stroke-width: 5;
}
<svg viewbox="0 0 100 100">
<polyline points="0,0 5,10 20,20 30,5 50, 20, 100,100">
</svg>

有人可以帮忙吗?有可能吗?

最佳答案

大概你只是想停止像这样保留 viewBox 的纵横比......

* {
margin: 0;
padding: 0;
}

html,
body,
svg {
overflow-x: hidden;
overflow-y: hidden;
width: 100%;
height: 100%;
}

polyline {
fill: none;
stroke: gray;
stroke-width: 5;
}
<svg viewBox="0 0 100 100" preserveAspectRatio="none">
<polyline points="0,0 5,10 20,20 30,5 50, 20, 100,100">
</svg>

关于html - 如何让 SVG 多段线以百分比表示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44476602/

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