SVG <tekst>
Tekst SVG — <tekst>
Element <text> służy do definiowania tekstu.
Przykład 1
Napisz tekst:
Oto kod SVG:
Przykład
<svg height="30" width="200">
<text x="0" y="15" fill="red">I
love SVG!</text>
</svg>
Przykład 2
Obróć tekst:
Oto kod SVG:
Przykład
<svg height="60" width="200">
<text x="0" y="15" fill="red"
transform="rotate(30 20,40)">I
love SVG</text>
</svg>
Przykład 3
Element <text> może być umieszczony w dowolnej liczbie podgrup z elementem <tspan>. Każdy element <tspan> może zawierać inne formatowanie i położenie.
Tekst w kilku liniach (z elementem <tspan>):
Oto kod SVG:
Przykład
<svg height="90" width="200">
<text x="10" y="20" style="fill:red;">Several lines:
<tspan x="10" y="45">First line.</tspan>
<tspan x="10" y="70">Second line.</tspan>
</text>
</svg>
Przykład 4
Tekst jako link (z elementem <a>):
Oto kod SVG:
Przykład
<svg height="30" width="200"
xmlns:xlink="http://www.w3.org/1999/xlink">
<a xlink:href="https://www.w3schools.com/graphics/"
target="_blank">
<text x="0" y="15" fill="red">I love SVG!</text>
</a>
</svg>