首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无xlink的SVG textPath

无xlink的SVG textPath
EN

Stack Overflow用户
提问于 2015-06-05 05:43:39
回答 1查看 642关注 0票数 7

是否可以定义textPath的内联路径,而不是创建def并将其作为xlink:href作为属性引用?

代码语言:javascript
复制
  <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>

所以有没有可能有像这样的东西

代码语言:javascript
复制
<text>
    <textPath path="M 100 200 C 200 100 300 0 400 100">
        My text along a path
    </textPath>
</text>

这不起作用,但是像这样的东西呢?

EN

回答 1

Stack Overflow用户

发布于 2015-06-05 06:03:41

这是新的SVG2规范中的路径,您可以使用feature属性。

新的SVG2特性的浏览器实现正在进行中。下面的示例可以在Firefox中运行,但不确定在其他地方。

代码语言:javascript
复制
html, body {
  height: 100%;
  width: 100%;
}
代码语言:javascript
复制
<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>

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30654713

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档