---
title: HTMLCanvasElement
framework: webkitjs
role: symbol
role_heading: Class
path: webkitjs/htmlcanvaselement
---

# 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.

## Declaration

```data
interface HTMLCanvasElement
```

## Overview

Overview note: For usage examples and conceptual guidance, see Safari HTML5 Canvas Guide.

## Topics

### Setting Canvas Dimensions

- [width](webkitjs/htmlcanvaselement/1632871-width.md)
- [height](webkitjs/htmlcanvaselement/1634228-height.md)

### Obtaining a Context

- [getContext](webkitjs/htmlcanvaselement/1629325-getcontext.md)

### Getting an Image

- [toDataURL](webkitjs/htmlcanvaselement/1630000-todataurl.md)

## Relationships

### Inherits From

- [HTMLElement](webkitjs/htmlelement.md)
