SVG 文本多行

发布于 2025-01-07 11:39:01 字数 47 浏览 2 评论 0原文

好吧,我有一些文本,想知道当窗口变小时使其在一行上自动跨越多行的最佳方法是什么?

Ok so I have some text and was wondering what the best way to get it to automatically span several lines when the window gets to small for it to be on one line?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

漫雪独思 2025-01-14 11:39:01

并不是真正的答案,而是对 http://pastebin.com/gaQbW9LL 的回应。

一个相当明显的错误是您正在创建 html 元素,但在 svg 命名空间中:

var bodyEle = document.createElementNS(svgns,'body');

这应该是,例如:

var bodyEle = document.createElementNS(xhtmlns,'body');

其中 xhtmlns 是 http://www.w3.org/1999/xhtml

Not really an answer, but a response to http://pastebin.com/gaQbW9LL.

One rather obvious error is that you're creating html elements but in the svg namespace:

var bodyEle = document.createElementNS(svgns,'body');

That should be, e.g:

var bodyEle = document.createElementNS(xhtmlns,'body');

where xhtmlns is http://www.w3.org/1999/xhtml.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文