SVG <polyline>元素

<polyline>元素用於繪製連接的直線。

聲明

以下是<polyline>元素的語法聲明。這裏只顯示了一些主要屬性。

<polyline
   points="list of points" >
</polyline>

屬性

編號 屬性 描述
1 points 組成折線的點列表。

示例

檔:testSVG.html -

<html>
   <title>SVG折線</title>
   <body>

      <h1>簡單SVG折線圖片</h1>

      <svg width="800" height="800">
         <g>
            <text x="0" y="15" fill="black" >Polyline #1: Without opacity.</text>

            <polyline points="150,75 258,137.5 258,262.5 150,325 42,262.6 42,137.5"
            stroke="black" stroke-width="3" fill="none"></polyline>
         </g>
      </svg>

   </body>
</html>

在Chrome網路流覽器中打開testSVG.html。 您可以使用Chrome/Firefox/Opera直接查看SVG圖像,無需任何插件。 Internet Explorer 9及更高版本還支持SVG圖像呈現。

使用opacity示例

<html>
   <title>SVG折線</title>
   <body>

      <h1>簡單SVG折線圖片</h1>

      <svg width="800" height="800">
         <g>
            <text x="0" y="15" fill="black" >Polyline #2: With opacity </text>

            <polyline points="150,75 258,137.5 258,262.5 150,325 42,262.6 42,137.5"
            style="fill:none;stroke-width:3;
            stroke:rgb(0,0,0);stroke-opacity:0.5;"></polyline>
         </g>
      </svg>

   </body>
</html>

在流覽器中打開上述代碼,顯示效果如下 -


上一篇: SVG形狀 下一篇: SVG文本