+ 1

Line break does not work in canvas

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

2nd Feb 2020, 1:39 PM
Anna/Аня
Anna/Аня - avatar
5 odpowiedzi
+ 2
It should be backslash \ for escaping character Explicitly, line break is \n instead of /n.
2nd Feb 2020, 1:42 PM
Gordon
Gordon - avatar
+ 2
I think Aymane's link best explains how to do "line break" in canvas fillText() with for loop.
2nd Feb 2020, 2:15 PM
Gordon
Gordon - avatar
+ 1
Gordon I wrote it the first time, and then changed it for reinsurance
2nd Feb 2020, 2:13 PM
Anna/Аня
Anna/Аня - avatar
+ 1
Thanks all
2nd Feb 2020, 2:18 PM
Anna/Аня
Anna/Аня - avatar