+ 4
What did I do wrong?
I am trying to learn Html's canvas but I somehow did something wrong in even resizing the canvas! Can anyone show me what I did wrong? https://code.sololearn.com/WJIzI9yy4SM8/?ref=app
4 odpowiedzi
+ 2
1. getElementsByTagName return an array. Access the 1st element by using canvas[0] or just use Id directly.
2. The canvas may not be created yet, wrap the code in window.onload.
3. Meet Mehta Please don't encourage the use of resizing canvas through CSS.
It also scales the bitmaps inside.
https://code.sololearn.com/W8LJGkUCUvZS/?ref=app
+ 4
see this: https://youtu.be/EO6OkltgudE go to 6:33
+ 3
Meet Mehta appreciate your help but I am trying to use JS for resizing it.
+ 3
you are just editing css with js. i want to directly edit the size of the canvas with js.