SVG <text>
- Page précédente Chemins SVG
- Page suivante Trace SVG
Texte SVG - <text>
<text>
L'élément est utilisé pour définir le texte.
Exemple 1
Écrivez un texte :
Voici le code SVG :
<svg height="30" width="200"> <text x="0" y="15" fill="red">Je aime SVG!</text> </svg>
Exemple 2
Rotation du texte :
Voici le code SVG :
<svg height="60" width="200"> <text x="0" y="15" fill="red" transform="rotate(30 20,40)">Je aime SVG</text> </svg>
Exemple 3
<text>
élément peut être <tspan>
éléments ensemble, ils sont organisés en un nombre illimité de sous-groupes. Chaque <tspan>
Les éléments peuvent contenir différents formats et positions.
Texte multiligne (utilisez l'élément <tspan>) :
Voici le code SVG :
<svg height="90" width="200"> <text x="10" y="20" style="fill:red;">Plusieurs lignes : <tspan x="10" y="45">Première ligne.</tspan> <tspan x="10" y="70">Deuxième ligne.</tspan> </text> </svg>
Exemple 4
comme texte de lien (avec <a>
élément) :
Voici le code SVG :
<svg height="30" width="200" xmlns:xlink="http://www.w3.org/1999/xlink"> <a xlink:href="www.codew3c.com/graphics/index.asp" target="_blank"> <text x="0" y="15" fill="red">Je aime SVG!</text> </a> </svg>
- Page précédente Chemins SVG
- Page suivante Trace SVG