line element | SVGLineElement object
Defines a line by using beginning and ending (x,y) coordinate values with stroke and stroke-width styles .
![]() ![]() |
DOM Information
Inheritance Hierarchy
Members
The SVGLineElement object has these types of members:
Events
The SVGLineElement object has these events.
| Event | Description |
|---|---|
| onload |
Occurs when the browser has fully parsed the element and all of its descendants. |
Methods
The SVGLineElement object has these methods.
| Method | Description |
|---|---|
| getBBox |
Gets the bounding box, in current user space, of the geometry of all contained graphics elements. |
| getCTM |
Gets the transformation matrix that transforms from the current user units to the viewport coordinate system for the nearestViewportElement object. |
| getScreenCTM |
Gets the transformation matrix from the current user units to the screen coordinate system. |
| getTransformToElement |
Gets the transformation matrix that transforms from the user coordinate system on the current element to the user coordinate system on the specified target element. |
| hasExtension |
Determines if the specified extension is supported. |
Properties
The SVGLineElement object has these properties.
| Property | Description |
|---|---|
|
Gets the names of the classes that are assigned to this object. | |
|
Sets or retrieves a reference to the SVG graphical object that will be used as the clipping path. | |
|
Gets a value that indicates whether referenced resources that are not in the current document are required to correctly render a given element. | |
|
Gets a value that represents the farthest ancestor svg element. | |
|
Sets or retrieves a value that indicates the color to paint the interior of the given graphical element. | |
|
Sets or retrieves a value that specifies the opacity of the painting operation that is used to paint the interior of the current object. | |
|
Sets or retrieves a value that indicates the algorithm that is to be used to determine what parts of the canvas are included inside the shape. | |
|
Determines if an element can acquire keyboard focus (that is, receive keyboard events) and be a target for field-to-field navigation actions (such as when a user presses the Tab key). | |
|
Sets or retrieves a value that specifies the marker symbol that is used for all vertices on the given path element or basic shape. | |
|
Sets or retrieves a value that defines the arrowhead or polymarker that is drawn at the final vertex of a given path element or basic shape. | |
|
Sets or retrieves a value that defines the arrowhead or polymarker that is drawn at every other vertex (that is, every vertex except the first and last) of a given path element or basic shape. | |
|
Sets or retrieves a value that defines the arrowhead or polymarker that is drawn at the first vertex of a given path element or basic shape. | |
|
Sets or retrieves a value that indicates a SVG mask. | |
|
Gets a value that indicates which element established the current viewport. | |
|
Gets the nearest ancestor svg element. | |
|
Sets or retrieves a value that specifies under what circumstances a given graphics element can be the target element for a pointer event in SVG. Starting with IE11, this property also has basic support for HTML elements (see "Remarks" section). | |
|
Gets a white space-delimited list of required language extensions. | |
|
Gets or sets a white space-delimited list of feature strings. | |
|
Sets or retrieves a value that indicates the color to paint along the outline of a given graphical element. | |
|
Sets or retrieves one or more values that indicate the pattern of dashes and gaps used to stroke paths. | |
|
Sets or retrieves a value that specifies the distance into the dash pattern to start the dash. | |
|
Sets or retrieves a value that specifies the shape to be used at the end of open subpaths when they are stroked. | |
|
Sets or retrieves a value that specifies the shape to be used at the corners of paths or basic shapes when they are stroked. | |
|
Sets or retrieves a value that indicates the limit on the ratio of the length of miter joins (as specified in the strokeLinejoin property). | |
|
Sets or retrieves a value that specifies the opacity of the painting operation that is used to stroke the current object. | |
|
Sets or retrieves a value that specifies the width of the stroke on the current object. | |
|
Gets a style object. | |
|
Gets or sets a comma-separated list of language names. | |
|
Gets the value of a transform attribute. | |
|
Gets the element that established the current viewport. | |
|
Gets or sets the x-coordinate for the start of a line. | |
|
Gets or sets the x-coordinate for the end of a line. | |
|
Gets or sets the | |
|
Gets or sets a value that specifies the language that is used in the contents and attribute values of an element. | |
|
Gets or sets a value that indicates whether white space is preserved in character data. | |
|
Gets or sets the y-coordinate for the start of a line. | |
|
Gets or sets the y-coordinate for the end of a line. |
Standards information
- Scalable Vector Graphics: Basic Shapes, Section 9.8.4
Remarks
Examples
In the following code example, the line element is used to draw a salmon-colored line inside an inline SVG element. Copy this sample to a text file and save it with the .html file extension. Run it in Internet Explorer 9 to see a salmon-colored line.
It should look like this:
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<svg width="400" height="400">
<line x1="50" y1="50" x2="150" y2="150" style="stroke:salmon; stroke-width:10" />
</svg>
</body>
</html>
See also

