Javascript examples for Canvas Reference:lineWidth
The lineWidth property sets or gets the current line width in pixels. Default value is 1.
context.lineWidth = number;
Value | Description |
---|---|
number | The current line width, in pixels |
Draw a rectangle with a line width of 10 pixels:
<!DOCTYPE html> <html> <body> <canvas id="myCanvas" width="300" height="250" style="border:1px solid #d3d3d3;"> Your browser does not support the HTML5 canvas tag.</canvas> <script> var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); ctx.lineWidth = 10;/*from w ww .j ava 2 s . c o m*/ ctx.strokeRect(20, 20, 80, 100); </script> </body> </html>