<canvas>Alternate text goes here, should the browser not support the canvas tag.</canvas>
There are two major attributes associated with the
width. These will set the element height and width, in pixels. They default to a height of 150px, and a width of 300px.
Suppose that a multi-user whiteboard application needs a canvas for the users to interact with. Further, it is important that the canvas is 800px wide, and 600px tall. Additionally it is important to provide a fallback message should the canvas not work.
<html><head> </head><body><canvas width="800" height="600"><h3>Your browser does not support this feature. Please switch to anotherbrowser, if possible.</h3></canvas></body></html>
Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.
Learn HTML on Codecademy
Front-End EngineerFront-end engineers work closely with designers to make websites beautiful, functional, and fast.
Includes 34 Courses
With Professional Certification