Class

HTMLCanvasElement

A canvas is an HTML element that defines a runtime drawing region within your web content. You can access the canvas as a JavaScript object and obtain a drawing context from it, in the form of a CanvasRenderingContext2D object. You draw on the canvas by using the JavaScript methods of the CanvasRenderingContext2D class.

Overview

Topics

Setting Canvas Dimensions

width

An integer containing the width of the canvas in CSS pixels.

height

An integer containing the height of the canvas in CSS pixels.

Obtaining a Context

getContext

Returns the drawing context for the canvas.

Getting an Image

toDataURL

Returns a data URL containing an image of the canvas.

Relationships

Inherits From