0

I've made an HTML canvas, and I would like to put a break in the canvas text after the username variable but it is not recognizing the line breaks I have tried so far e.g \n or <br />. This is the code

function drawText() {
  let startText = "Welcome "+username+"You've answered "+questionCount+" out of 10";
  ctx.font = '30px Calibri';//size and type of font
  ctx.fillStyle = "#f0f0f0";//colour of font
  ctx.textAlign = "center";
  ctx.fillText(startText, 350, 350);
}

window.addEventListener("load", drawText(), false);
dguy
  • 1

0 Answers0