VOOZH about

URL: https://www.geeksforgeeks.org/html/svg-line/

⇱ SVG Line - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

SVG Line

Last Updated : 28 Apr, 2025

The SVG Line is used to draw lines in SVG format. Element <line> has other attributes too like a stroke for specifying the color of the stroke and the stroke width for specifying the thickness of the width.

Attributes

  • x1: Defines the starting point of the line on the x-axis.
  • y1: Defines the starting point of the line on the y-axis.
  • x2: Defines the ending point of the line on the x-axis.
  • y2: Defines the ending point of the line on the y-axis.
  • stroke: Specifies the color of the stroke (outline) of the line.
  • stroke-width: Specifies the thickness or width of the line.

Example 1: This example shows an SVG <line> element with a stroke color.

Output:

👁 Screenshot-2023-11-21-105456
SVG Lines

Example 2: This example shows an SVG <line> element with stroke color and stroke-width.

Output:

👁 Screenshot-2023-11-21-105319
SVG Lines
Comment
Article Tags: