The HTML canvas lineWidth property is used to set or return the width of the line (thickness of the line). The width of the line is set in terms of pixels. The default value of this property is 1.
Syntax:
context.lineWidth = number;
Property Values:
- number: This property value indicates the number which specifies the line width in terms of pixels. This property ignores the zero, negative, infinity, and NaN values.
Example 1:
Output:
👁 Image
Program 2:
Output:
👁 Image
Supported Browsers: The browser supported by HTML canvas lineWidth property are listed below:
- Google Chrome
- Internet Explorer 9.0
- Firefox
- Safari
- Opera