mozilla
Your Search Results

    x2

    « 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 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 SVGLength or an SVGAnimatedLength.

    Example

    The x2 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 x2="10" 
              y2="110" x1="60" y1="10"
              stroke="black" />
    
    	<line x2="60" 
              y2="110" x1="60" y1="10"
              stroke="black" />
    
        <line x2="110" 
              y2="110" x1="60" y1="10"
              stroke="black" />
    </svg>
    

    » x2.svg

    The x2 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>

    » linearGradient.svg

    Elements

    The following elements can use the x2 attribute

    See also

    Document Tags and Contributors

    Contributors to this page: Jeremie
    Last updated by: Jeremie,