未定义SVG名称空间前缀xlink for href文本路径 [英] SVG Namespace prefix xlink for href on textpath is not defined
问题描述
< 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屋!