未定义SVG名称空间前缀xlink for href文本路径 [英] SVG Namespace prefix xlink for href on textpath is not defined

查看:338
本文介绍了未定义SVG名称空间前缀xlink for href文本路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我试图制作一个简单的文本路径.svg,它将与某些文本成为垂直线。我得到的问题是,标签似乎把所有东西都扔掉了。我认为这与我的xlink:href有关,但我似乎无法确定究竟是什么。

< svg version = 1.1baseProfile =fullwidth =20height =600xmlns =http://www.w3.org/2000/svg> < DEFS> < path id =testPathd =M 10 10 L 10 600 zstroke =blackstroke-width =3/> < / DEFS> <文本> < textpath xlink:href =#testPath> teeeest< / textpath> < /文本> < / svg>



解决方案

SVG是一种区分大小写的语言,因此textpath实际上需要写为textPath。



如果您将SVG嵌入到html中,那么您不需要命名空间,因为html不支持它们(不像xhtml)。如果你的SVG是独立的,你还需要 xmlns:xlink =http://www.w3.org/1999/xlink c>< svg> 元素。


So I'm trying to make a simple textpath .svg that would be a vertical line with some text. The problem I am getting is that the tags seem to throw everything off. I think it has something to do with my xlink:href but I can't seem to pin down what exactly.

<svg version="1.1"
     baseProfile="full"
     width="20" height="600"
     xmlns="http://www.w3.org/2000/svg">
     
   <defs>
          <path id="testPath" d="M 10 10 L 10 600 z"
         stroke="black" stroke-width="3" />
   </defs>
   
   <text>
      <textpath xlink:href="#testPath">
         teeeest
      </textpath>
   </text>
   
</svg>

Any help would be appreciated.

解决方案

SVG is a case sensitive language so textpath actually needs to be written as textPath.

If you embed the SVG in html then you don't need namespaces as html doesn't support them (unlike xhtml). If you have your SVG standalone you'll also need xmlns:xlink="http://www.w3.org/1999/xlink" on the root <svg> element.

这篇关于未定义SVG名称空间前缀xlink for href文本路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆