<line>

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

<line>SVG の要素で、 SVG の基本図形であり、2 つの点をつなぐ直線を作成するために使用します。

html
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
  <line x1="0" y1="80" x2="100" y2="20" stroke="black" />

  <!-- If you do not specify the stroke
       color the line will not be visible -->
</svg>

属性

x1

線の始点の X 座標を定義します。 値の型: <length> | <percentage> | <number>; 既定値: 0; アニメーション:

x2

線の終点の X 座標を定義します。 値の型: <length> | <percentage> | <number>; 既定値: 0; アニメーション:

y1

線の始点の Y 座標を定義します。 Value type: <length> | <percentage> | <number>; 既定値: 0; アニメーション:

y2

線の終点の Y 座標を定義します。 Value type: <length> | <percentage> | <number>; 既定値: 0; アニメーション:

pathLength

パス全体の長さをユーザーの単位で定義します。 Value type: <number>; 既定値: none; アニメーション:

使用上のメモ

カテゴリー基本シェイプ要素、グラフィック要素、図形要素
許可されている内容任意の数、任意の順序の以下の要素。
アニメーション要素
説明的要素

仕様書

Specification
Scalable Vector Graphics (SVG) 2
# LineElement

ブラウザーの互換性

関連情報