[英]SVG textPath without xlink
是否可以内联定义 textPath 的路径,而不是创建 def 并将其作为 xlink:href 作为属性进行引用?
<defs>
<path id="MyPath"
d="M 100 200
C 200 100 300 0 400 100" />
</defs>
<use xlink:href="#MyPath"/>
<text>
<textPath xlink:href="#MyPath">
My text along a path
</textPath>
</text>
那么是否有可能有类似的东西
<text>
<textPath path="M 100 200 C 200 100 300 0 400 100">
My text along a path
</textPath>
</text>
这不起作用,但像这样的事情?
这是新的 SVG 2 规范中的一项功能,您可以使用 path 属性。
新 SVG 2 功能的浏览器实现正在进行中。 下面的示例在 Firefox 中确实有效,但不确定其他地方。
html, body { height: 100%; width: 100%; }
<svg height="100%" width="100%"> <text> <textPath path="M 100 200 C 200 100 300 0 400 100"> My text along a path </textPath> </text> </svg>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.