<polyline>

**<polyline>** SVG 元素是 SVG 基本形狀之一,用於建立連線多個點的直線。通常 polyline 用於建立開放形狀,因為最後一個點不必連線到第一個點。對於閉合形狀,請參見 <polygon> 元素。

示例

html
<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg">
  <!-- Example of a polyline with the default fill -->
  <polyline points="0,100 50,25 50,75 100,0" />

  <!-- Example of the same polyline shape with stroke and no fill -->
  <polyline points="100,100 150,25 150,75 200,0" fill="none" stroke="black" />
</svg>

屬性

points

此屬性定義繪製折線所需的點列表(x,y 絕對座標對)。值型別<number>+;預設值""可動畫

pathLength

此屬性允許指定路徑的總長度(以使用者單位表示)。值型別<number>預設值可動畫

使用環境

類別基本形狀元素、圖形元素、形狀元素
允許內容以下元素的任意數量,以任意順序
動畫元素
描述性元素

規範

規範
可縮放向量圖形 (SVG) 2
# PolylineElement

瀏覽器相容性

BCD 表格僅在啟用 JavaScript 的瀏覽器中載入。

另請參閱