gpt4 book ai didi

html - 将 SVG 元素并排放置

转载 作者:行者123 更新时间:2023-11-28 01:33:27 27 4
gpt4 key购买 nike

我有一个 <text>和一个 <rect>元素嵌套在 svg 中元素。我想要 <rect>元素在 <text> 之后开始结束。但看起来我必须使用 x 来定位它们和 y .

有什么方法可以像普通 HTML 元素一样将它们并排放置吗?

<svg>
<text>1200</text>
<rect width='120' height='12'></rect>
</svg>

最佳答案

我似乎只能用这个来得到它:

<svg height="30" width="100">
<text x="0" y="15" fill="red">SVG TEXT!</text>
</svg>
<svg height="30" width="100">
<rect width='120' height='12'></rect>
</svg>

在此处查看 James Almeida 的笔“SVG 文本和框测试”:http://codepen.io/jimmyplaysdrums/pen/ZYdEyw/

关于html - 将 SVG 元素并排放置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29526180/

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