SVG <polyline>
SVG 折線 - <polyline>
<polyline>
元素用於建立僅由直線(在多個點連線)組成的任何形狀。
<polyline>
元素有一個基本屬性,用於定義折線的點:
Attribute | 描述 |
---|---|
points | 必需。折線的點列表。每個點必須包含 x 座標和 y 座標。 |
折線示例
以下示例建立一個折線:
這是 SVG 程式碼
示例
<svg height="210" width="500" xmlns="http://www.w3.org/2000/svg">
<polyline points="0,0 50,150 100,75 150,50 200,140 250,140"
style="fill:none;stroke:green;stroke-width:3" />
</svg>
自己動手試一試 »
程式碼解釋
points
屬性定義了繪製折線所需的點(x 和 y 座標對)列表。
另一個折線示例
另一個僅包含直線的示例:
這是 SVG 程式碼
示例
<svg height="180" width="500" xmlns="http://www.w3.org/2000/svg">
<polyline points="0,40 40,40 40,80 80,80 80,120 120,120 120,160"
style="fill:yellow;stroke:red;stroke-width:4" />
</svg>
自己動手試一試 »