stroke.width Number. Note: To set both the fill and stroke for HTML5 canvas text, you must use both the fillText() and strokeText() methods together. ", 10, 50); ctx.font = "30px Verdana"; // Create Set the line width. The lineWidth property must be set before calling stroke(). When a default stroke join is set to mitered, this property specifies when the join will be converted to beveled (squared-off ) by default. JavaScript: var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); ctx.strokeStyle = "#FF0000"; ctx.strokeRect(20, 20, 150, 100); Try it Yourself . px and em) are not required. At the moment the following draws two lines, but I can't seem to change the width: var a = [23,50]; for (b = 0; b < a.length; b++) { var stripe = javascript for border color. const canvas = document.getElementById("canvas"); const ctx = canvas.getContext("2d"); ctx.lineWidth = 15; ctx.beginPath(); ctx.moveTo(20, 20); ctx.lineTo(130, 130); ctx.rect(40, 40, The fillText () method allows you to draw a text string at a coordinate with the fill derived from the current fillStyle. I had experienced a similar scenario and the best way is to put the svg file in an