« SVG Attribute reference home
For the <line> element, this attribute define the y-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 y-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 0% 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 SVGLengthor anSVGAnimatedLength.
Example
The y2 attribute on the <line> element
| Source code | Output result | 
|---|---|
| <?xml version="1.0"?>
<svg width="120" height="120" 
     viewPort="0 0 120 120" version="1.1"
     xmlns="http://www.w3.org/2000/svg">
    <line y2="10" 
          x2="110" x1="10" y1="60"
          stroke="black" />
	<line y2="60" 
          x2="110" x1="10" y1="60"
          stroke="black" />
    <line x2="110" 
          y2="110" x1="10" y1="60"
          stroke="black" />
</svg>
 | 
» y2.svg
The y2 attribute on the <lineargradient> element
| Source code | Output result | 
|---|---|
| <?xml version="1.0"?>
<svg width="120" height="120"  viewBox="0 0 120 120"
     xmlns="http://www.w3.org/2000/svg" version="1.1"
     xmlns:xlink="http://www.w3.org/1999/xlink" >
    <defs>
        <linearGradient id="MyGradient">
            <stop offset="5%"  stop-color="green"/>
            <stop offset="95%" stop-color="gold"/>
        </linearGradient>
    </defs>
    <rect fill="url(#MyGradient)"
          x="10" y="10" width="100" height="100"/>
</svg> | 
Elements
The following elements can use the y2 attribute