VOOZH about

URL: https://www.geeksforgeeks.org/html/svg-x2-attribute/

⇱ SVG x2 Attribute - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

SVG x2 Attribute

Last Updated : 23 Jul, 2025

The x2 attribute is used to specify the first x-coordinate for drawing an SVG element that requires more than one coordinate.

Elements that are using this attribute:

Syntax:

x2 = "x2-coordinate"

Attribute Values:

  • length: Length at which we want to set the x2-coordinate.
  • percentage: Percentage at which we want to set the x2-coordinate.

We will use the x2 attribute for setting the x2-coordinate.

Example 1: In this example we will use the length value.

Output:

👁 Image

Example 2: In this example we will use the percentage value. 

Output:

👁 Image
Comment