如何在SVG中生成不同大小的内联文本?

如何在SVG中生成不同大小的内联文本?,svg,Svg,在HTML中,为不同的单词创建不同字体大小的文本非常容易。但是svg中的呢 我认为这很好地解释了我的问题: 一切都在下面: <div> This is a text, and you can have <span style="font-size:25px">big</span> and <span style="font-size:11px">small</span> sizes easily inline. </div>

在HTML中,为不同的单词创建不同字体大小的文本非常容易。但是svg中的

我认为这很好地解释了我的问题:

一切都在下面:

<div>
This is a text, and you can have <span style="font-size:25px">big</span> and <span style="font-size:11px">small</span> sizes easily inline.
</div>

<div style="margin-top:50px">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="none" x="0px" y="0px" width="360px" height="126px" viewBox="0 0 360 126">
<text><tspan x="150" text-anchor="middle" y="10" font-family="Tahoma" font-weight="bold" font-size="11" fill="#003863" xml:space="preserve">What about this in a &lt;svg&gt;?</tspan></text></svg>
</div>

这是一个文本,你可以很容易地内联大小。
这在svg中又如何呢?
您可以使用
将HTML标记插入SVG文档:


这是一个文本,你可以很容易地内联大小。

您可以更改每个tspan元素的字体大小吗


改变尺寸不是那么难吗?

coool!这是。。。非常有趣和有用。
foreignObject
是否有任何限制或更多详细信息?@AwQiruiGuo Internet Explorer尚未接受foreignObject