+1

Line break does not work in canvas

ctx.fillText('Ура вы победили!\nСписок результатов:' , 125, 40) ; /n, /r, /r/n, +<br>+,+<br/>+,+<br\/> (I tried not working)

2/2/2020 1:39:51 PM

Anna/Аня

5 Answers

New Answer

+5

https://www.tutorialspoint.com/HTML5-canvas-ctx-fillText-won-t-do-line-breaks

+2

It should be backslash \ for escaping character Explicitly, line break is \n instead of /n.

+2

I think Aymane's link best explains how to do "line break" in canvas fillText() with for loop.

+1

Gordon I wrote it the first time, and then changed it for reinsurance

+1

Thanks all