1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
---
title: <polyline>
slug: Web/SVG/Element/polyline
tags:
- Element
- Graphisme
- Reference
- SVG
translation_of: Web/SVG/Element/polyline
---
{{SVGRef}}
L'élément SVG **`<polyline>`** est une forme SVG basique qui crée des lignes entre plusieurs points. Un élément `polyline` est généralement utilisé pour créer des tracés ouverts car le dernier point n'est pas nécessairement connecté avec le premier. Lorsqu'on désire réaliser des formes fermées, on privilégiera l'élément {{SVGElement("polygon")}}.
## Contexte d'utilisation
{{svginfo}}
## Attributs
### Attributs universels
- [Attributs de traitement conditionnel](/fr/docs/Web/SVG/Attribute#Attributs_de_traitement_conditionnel)
- [Attributs principaux](/fr/docs/Web/SVG/Attribute#Attributs_de_base)
- [Attributs relatifs aux évènements graphiques](/fr/docs/Web/SVG/Attribute#Attributs_d%27%C3%A9v%C3%A9nement_graphique)
- [Attributs de présentation](/fr/docs/Web/SVG/Attribute#Attributs_de_présentation)
- {{SVGAttr("class")}}
- {{SVGAttr("style")}}
- {{SVGAttr("externalResourcesRequired")}}
- {{SVGAttr("transform")}}
### Attributs spécifiques
- {{SVGAttr("points")}}
## Interface DOM
Cet élément implémente l'interface {{domxref("SVGPolylineElement")}}.
## Exemples
### Utilisation basique
#### SVG
```html
<svg width="120" height="120" xmlns="http://www.w3.org/2000/svg">
<polyline fill="none" stroke="black"
points="20,100 40,60 70,80 100,20"/>
</svg>
```
#### Résultat
{{EmbedLiveSample("Utilisation_basique", 120, 120)}}
### Escaliers
#### HTML
```html
<div class="contain-demo">
<svg width="150" height="200">
<desc>
Première polyligne orange avec
remplissage blanc.
</desc>
<polyline
points="0,40 40,40 40,80 80,80 80,120 120,120 120,160"
fill="white" stroke="#D07735" stroke-width="6" />
</svg>
<svg width="150" height="200">
<desc>
Seconde polyligne orange avec
remplissage jaune.
</desc>
<polyline
points="0,40 40,40 40,80 80,80 80,120 120,120 120,160"
fill="#F9F38C" stroke="#D07735" stroke-width="6" />
</svg>
</div>
```
#### CSS
```css
.contain-demo {
margin: 25px auto;
text-align: center;
}
```
#### Résultat
{{EmbedLiveSample("Escaliers", 400, 500)}}
## Spécifications
| Spécification | État | Commentaires |
| ------------------------------------------------------------------------------------------------ | ------------------------ | -------------------- |
| {{SpecName('SVG2', 'shapes.html#PolylineElement', '<polyline>')}} | {{Spec2('SVG2')}} | |
| {{SpecName('SVG1.1', 'shapes.html#PolylineElement', '<polyline>')}} | {{Spec2('SVG1.1')}} | Définition initiale. |
## Compatibilité des navigateurs
{{Compat("svg.elements.polyline")}}
## Voir aussi
- {{SVGElement("line")}}
- {{SVGElement("polygon")}}
|