- In HTML the <canvas> tag is used to draw graphics on a web page using JavaScript.
- It can be used to draw boxes, gradients, texts, paths and adding images.
- By default, it does not contain texts and borders.
- It allows for scriptable and dynamic rendering of 2D shapes and bitmap images.
- It does not have a built-in scene and becomes a low level, procedural model that updates a bitmap.
- There are several methods using <canvas> tag.
For example,
[pastacode lang=”markup” manual=”%3C!DOCTYPE%20html%3E%0A%3Chtml%3E%0A%3Cbody%3E%0A%0A%3Ccanvas%20id%3D%22myCanvas%22%20width%3D%22400%22%20height%3D%22250%22%20style%3D%22border%3A1px%20solid%20%23d3d3d3%3B%22%3E%0AYour%20browser%20does%20not%20support%20the%20HTML%20canvas%20tag.%3C%2Fcanvas%3E%0A%0A%3Cscript%3E%0Avar%20c%20%3D%20document.getElementById(%22myCanvas%22)%3B%0Avar%20ctx%20%3D%20c.getContext(%222d%22)%3B%0Actx.font%20%3D%20%2230px%20Arial%22%3B%0Actx.fillText(%22Welcome%20to%20Wikitechy%22%2C10%2C50)%3B%0A%3C%2Fscript%3E%0A%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E%0A” message=”” highlight=”” provider=”manual”/]Output

