SVG stroke-width Attribute
Last Updated :
31 Mar, 2022
The stroke-width attribute is an attribute defining the width of the stroke applied to the shape.
Syntax:
stroke-width="length"
Attribute Values:
- length: Length at which we want to set the stroke-width attribute
- percentage: Percentage at which we want to set the stroke-width attribute
We will use the stroke-width attribute for setting the width of the element.
Example 1: In this example we will use the stroke-width attribute for setting the width of rect using length value.
<!DOCTYPE html>
< html >
< body >
< svg viewBox = "0 0 110 80"
< circle cx = "15" cy = "15" r = "3"
stroke = "green" stroke-width = "11" />
</ svg >
</ body >
</ html >
|
Output:
Example 2: In this example, we will use the stroke-width attribute for setting the width of rect using percentage value.
<!DOCTYPE html>
< html >
< body >
< svg viewBox = "0 0 110 80"
< circle cx = "20" cy = "20" r = "6"
stroke = "green" stroke-width = "20%" />
</ svg >
</ body >
</ html >
|
Output
Share your thoughts in the comments
Please Login to comment...