<polyline>

Baseline 廣泛可用 *

此特性已相當成熟,可在許多裝置和瀏覽器版本上使用。自 ⁨2015 年 7 月⁩以來,各瀏覽器均已提供此特性。

* 此特性的某些部分可能存在不同級別的支援。

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

使用語境

分類基本形狀元素、圖形元素、形狀元素
允許內容可包含任意數量、任意順序的下列元素
動畫元素
描述性元素

屬性

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

路徑長度

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

DOM 介面

此元素實現了 SVGPolylineElement 介面。

示例

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>

規範

規範
Scalable Vector Graphics (SVG) 2
# PolylineElement

瀏覽器相容性

另見