SVG <polygon>
- Page précédente Lignes SVG
- Page suivante Courbes SVG
Le tag <polygon> est utilisé pour créer des figures composées d'au moins trois côtés.
Le tag <polygon>
Le tag <polygon> est utilisé pour créer des figures composées d'au moins trois côtés.
Veuillez copier le code suivant dans un bloc-notes, puis sauvegardez le fichier sous le nom "polygon1.svg". Placez ce fichier dans votre répertoire web :
<?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg"> <polygon points="220,100 300,210 170,250"} style="fill:#cccccc; stroke:#000000;stroke-width:1"/> </svg>
Explication du code :
L'attribut points définit les coordonnées x et y de chaque angle du polygone
L'exemple suivant crée un quadrilatère :
<?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg"> <polygon points="220,100 300,210 170,250 123,234" style="fill:#cccccc; stroke:#000000;stroke-width:1"/> </svg>
- Page précédente Lignes SVG
- Page suivante Courbes SVG