textPath Redirect 1

In addition to text drawn in a straight line, SVG also includes the ability to place text along the shape of a <path> element. To specify that a block of text is to be rendered along the shape of a <path>, include the given text within a textPath element which includes an xlink:href attribute with a reference to a <path> element.

Usage context

Categories Text content element, Text content child element
Permitted content Character data and any number of the following elements, in any order:
Descriptive elements »
<a>, <altglyph>, <animate>, <animatecolor>, <set>, <tref>, <tspan>
Normative document SVG 1.1 (2nd Edition)


<svg width="100%" height="100%" viewBox="0 0 1000 300"
    <path id="MyPath"
          d="M 100 200 
             C 200 100 300   0 400 100
             C 500 200 600 300 700 200
             C 800 100 900 100 900 100" />

  <use xlink:href="#MyPath" fill="none" stroke="red"  />

  <text font-family="Verdana" font-size="42.5">
    <textPath xlink:href="#MyPath">
      We go up, then we go down, then up again

  <!-- Show outline of the viewport using 'rect' element -->
  <rect x="1" y="1" width="998" height="298"
        fill="none" stroke="black" stroke-width="2" />

Live result:


Global attributes

Specific attributes

DOM Interface

This element implements the SVGTextPathElement interface.

Document Tags and Contributors

 Last updated by: Jeremie,