Draw a line with rounded end caps:
JavaScript:
![]()
Internet Explorer 9, Firefox, Opera, Chrome, and Safari support the lineCap property.
Note: Internet Explorer 8 and earlier versions, do not support the <canvas> element.
The lineCap property sets or returns the style of the end caps for a line.
Note: The value "round" and "square" make the lines slightly longer.
| Default value: | butt |
|---|---|
| JavaScript syntax: | context.lineCap="butt|round|square"; |
| Value | Description | Play it |
|---|---|---|
| butt | Default. A flat edge is added to each end of the line | Play it » |
| round | A rounded end cap is added to each end of the line | Play it » |
| square | A square end cap is added to each end of the line | Play it » |
HTML Canvas Reference
Your message has been sent to W3Schools.