0
how to add text into figures?
4 Answers
+ 1
do you mean including text inside of you svg? if that is the case you would insert the text element like so:
<svg width="300" height="300">
<text x="85" y="124">Text in SVG</text>
</svg>
0
what do you mean? I can't understand
0
Ok, you can just add text ON figures, not Into. Right in svg-area. But you need to accounting some coordinates/place fo your text.
My code #1 Text in random SVG-area
<svg width="250" height="250" stroke="black" stroke-width="3">
<circle cx="130" cy="130" r="100" fill="green"/>
<text x="10" y="130" fill="red" font-size="50px">
Text in SVG
</text>
</svg>
My code #2 Text on figure
<svg width="300" height="250" stroke="black">
<circle cx="130" cy="130" r="100" fill="green" stroke-width="5"/>
<text x="10" y="130" fill="red" font-size="50px">
Text in SVG
</text>
</svg>
My code#3 Text is on correct side, by adding the "text-anchor" attribute:
<svg width="300" height="250" stroke="black">
<circle cx="130" cy="130" r="100" fill="green" stroke-width="5"/>
<text x="130" y="130" fill="red" font-size="25px" text-anchor="middle">
Text in SVG
</text>
</svg>
Sorry for my English, I'm from Russia
- 1
jsjs