Canvas API 또는 WebGL API를 사용해서 그래픽 처리와 애니메이션 등 시각적 이미지를 즉시 렌더링하는 데 사용한다.
임베디드 콘텐츠(embedded-content)가 예상되는 위치
typedef (CanvasRenderingContext2D or ImageBitmapRenderingContext or WebGLRenderingContext or WebGL2RenderingContext or GPUCanvasContext) RenderingContext;
[Exposed=Window]
interface HTMLCanvasElement : HTMLElement {
[HTMLConstructor] constructor();
[CEReactions] attribute unsigned long width;
[CEReactions] attribute unsigned long height;
RenderingContext? getContext(DOMString contextId, optional any options = null);
USVString toDataURL(optional DOMString type = "image/png", optional any quality);
undefined toBlob(BlobCallback _callback, optional DOMString type = "image/png", optional any quality);
OffscreenCanvas transferControlToOffscreen();
};
callback BlobCallback = undefined (Blob? blob);
<canvas></canvas>
일부 글로벌 애트리뷰트는 이 요소에서 사용되지 않을 수 있다.
일부 글로벌 이벤트 핸들러는 이 요소에서 사용되지 않을 수 있다. 이벤트 등록은 자바스크립트 사용을 권장한다.