Namespace prefix xlink问题

来源:5-4 SVG-路径文本

stono

2015-02-25 10:36

我写出来的代码会有这样的问题:

This page contains the following errors:


error on line 5 at column 29: Namespace prefix xlink for href on textpath is not defined

Below is a rendering of the page up to the first error.


写回答 关注

1回答

  • stono
    2015-02-25 10:51:35

    哦,写在html中就好了,直接写成svg是不行的;

    <!DOCTYPE html>

    <html>

    <head>

    <meta charset="UTF-8"/>

    <title>textpath</title>

    </head>

    <body>

    <svg xmlns='http://www.w3.org/2000/svg' width='800' height='600'>

        <path id="path1" d='M 100 200 Q 200 100 300 200 T 500 200' stroke='rgb(0,255,0)' fill='none'>

        </path>

        <text style='font-size:24px;'>

            <textpath xlink:href='#path1'>

                这个文字先上去,又下来了。Upside down in english!

            </textpath>

        </text>

    </svg>

    </body>

    </html>


走进SVG

SVG是HTML5 中矢量图的标记语言,学习后掌握更多的干货

52668 学习 · 213 问题

查看课程

相似问题