« SVG Attribute reference home
For the <line>
element, this attribute define the x-axis coordinate of the end of the line. If the attribute is not specified, the effect is as if a value of 0 were specified.
For the <linearGradient>
element, this attribute define the x-axis coordinate of the end of the vector gradient onto which the <stop>
elements are mapped. If the attribute is not specified, the effect is as if a value of 100% were specified.
Usage context
Categories | None |
---|---|
Value | <coordinate> |
Animatable | Yes |
Normative document | SVG 1.1 (2nd Edition): The line element SVG 1.1 (2nd Edition): The linearGradient element |
- <coordinate>
-
A <coordinate> is a length in the user coordinate system that is the given distance from the origin of the user coordinate system along the relevant axis (the x-axis for X coordinates, the y-axis for Y coordinates). Its syntax is the same as that for <length>.
Within the SVG DOM, a <coordinate> is represented as an
SVGLength
or anSVGAnimatedLength
.
Example
The x2 attribute on the <line>
element
Source code | Output result |
---|---|
Unable to find file x2.svg |
Unable to find file x2.svg |
» x2.svg
The x2 attribute on the <linearGradient>
element
Source code | Output result |
---|---|
Unable to find file linearGradient.svg |
Unable to find file linearGradient.svg |
Elements
The following elements can use the x2
attribute