Can anyone explain kindly Canvas elements and their attributes ? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula gr√°tis
+ 5

Can anyone explain kindly Canvas elements and their attributes ?

Elements and attributes of canvas

12th Apr 2021, 4:16 AM
Karine
Karine - avatar
1 Resposta
+ 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: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas 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: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D 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: https://www.w3schools.com/html/html5_canvas.asp
12th Apr 2021, 8:57 AM
Josh Greig
Josh Greig - avatar