Insert HTML code inside SVG Text element

Why not use an SVG <a> element in this case? Don’t forget that the href needs to be xlink:href though. E.g.

<text x="10" y="54" text-anchor="start" class="barLegend"><a xlink:href="http://www.gmail.com">Gmail</a></text>

Only SVG animation elements, descriptive elements (<title> or <desc>), text content child elements (<tspan> or <textPath>) or the SVG <a> element are allowed as children of text elements.

Leave a Comment