VOOZH about

URL: https://www.geeksforgeeks.org/html/svg-stroke-width-attribute/

⇱ SVG stroke-width Attribute - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

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.

Output:

👁 Image

Example 2: In this example, we will use the stroke-width attribute for setting the width of rect using percentage value.

Output

👁 Image
Comment