Can anyone explain kindly Canvas elements and their attributes ? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 5

Can anyone explain kindly Canvas elements and their attributes ?

Elements and attributes of canvas

12th Apr 2021, 4:16 AM
Karine - avatar
1 Antwort
+ 6
A canvas has no valid child DOMElements if that's part of your question. Some people add a text node like <canvas>canvas not supported.</canvas> but you're not supposed to add span, p tags... in it. The canvas has a height and width attribute which specify number of pixels width and height to use for its bitmap image. This doesn't need to match pixels displayed but often does. More official documentation on these attributes are at: If you're just starting to use the HTML5 canvas, you'll want to learn about its 2d context. Many properties and methods of the object returned from calling getContext('2d') on your canvas are explained here: That website explains in great detail many classes used with a canvas. If that's too much detail for you and you want more of a beginner tutorial, check:
12th Apr 2021, 8:57 AM
Josh Greig
Josh Greig - avatar