The SVG offers several stroke properties to be applied to the SVG element. There are lots of properties under stroke properties which can be applied any kind of lines, text, and outlines of elements like a circle.
<elementName stroke="stroke color" stroke-width="Width of the stroke" stroke-linecap="Ending style to a stroke" stroke-dasharray="make a dashed stroke">
- stroke: set the stroke to an element.
- stroke-width: set the stroke width of an element.
- stroke-linecap: sets the ending stroke style.
- stroke-dasharrray: set the style os a stroke such as dashed stroke.
Few examples are given below:
Example 1: Stroke and stroke-dasharray property:
Example 2: stroke-width and stroke-linecap property:
Supported Browsers :
- Internet Explorer
- SVG stroke-width Attribute
- SVG stroke Attribute
- SVG stroke-dasharray Attribute
- SVG stroke-opacity attribute
- SVG stroke-linecap attribute
- Why Transition properties does not work with display properties ?
- HTML | canvas stroke() Method
- p5.js | stroke() Function
- CSS | stroke-width Property
- CSS | stroke-linecap Property
- CSS | stroke-opacity Property
- CSS | stroke-dashoffset Property
- CSS | stroke-dasharray Property
- CSS | stroke-linejoin Property
- Node.js | GM stroke() Function
- CSS | stroke-miterlimit Property
- Fabric.js | Text stroke Property
- How to add stroke width of text canvas using Fabric.js ?
- Fabric.js | Circle stroke Property
- How to set stroke width of a canvas circle using Fabric.js ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.