SVG TutorialLOGIN
SVG Tutorial
author:php.cn  update time:2022-04-18 17:51:50

SVG straight line


The

<line> element is used to create a straight line:

Here is the SVG code:

Example

<!DOCTYPE html>
<html>
<body>

<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
  <line x1="0" y1="0" x2="200" y2="200" style="stroke:rgb(255,0,0);stroke-width:2" />
</svg>

</body>
</html>

Run Instance»

Click the "Run Instance" button to view the online instance

For Opera users: View SVG file right-click Click on the SVG graphic preview source).

  • x1 property defines the start of the line on the x-axis

  • y1 property defines the start of the line on the y-axis

  • x2 property defines the end of the line on the x-axis

  • y2 property defines the end of the line on the y-axis

php.cn