7

I have two lines of text each <tspan> tag for each.

<tspan dy="-11.7890625">welocme</tspan> <tspan dy="16.8" x="285.75">text</tspan>

Need a line break between them. but <br> is not working. Can any one help me out here?

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
affu
  • 141
  • 1
  • 8

1 Answers1

11

I think this is not possible.

You can however use multiple tspan elements inside text element and use em units for dy attribute. Have in mind that there are two possible positioning attributes:

  • (x & y) - set absolute position
  • (dx & dy) - set relative position

<svg width="200" height="200">
  <text x="0" y="0">
    <tspan x="0" dy="1em">Hello</tspan>
    <tspan x="0" dy="1em">World</tspan>
  </text>
</svg>
Pavle
  • 145
  • 11