关于tspan

来源:2-5 文本的辅助标签tspan与textPath

慕仙0328516

2021-01-13 09:21:38

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 50" xml:space="preserve">

    <text font-size="12px" font-weight="bold">

        <tspan x="0" y="10" stroke="#C7000B" stroke-width="0.1" fill="transparent">www.imooc.com</tspan>

        <tspan x="0" y="25" fill="#C7000B">www.imooc.com</tspan>

    </text>

</svg>

这个宽度刚好显示够

如果第一个tspan是

<tspan x="0" y="10" stroke="#C7000B" stroke-width="0.1" fill="transparent">www.imooc.comabcd</tspan>

后面的abcd会自动截断,不会换行吗

写回答

1回答

好帮手慕久久

2021-01-13

同学你好,是的。svg本身就不支持换行,所以tspan中的内容如果超出,会直接截断,而不会换行。

祝学习愉快!

0

0 学习 · 4826 问题

查看课程