OffscreenCanvas: width property

The width property returns and sets the width of an OffscreenCanvas object.

Value

Examples

Creating a new offscreen canvas and returning or setting the width of the offscreen canvas:

js

const offscreen = new OffscreenCanvas(256, 256);
offscreen.width; // 256
offscreen.width = 512;

Specifications

Specification
HTML Standard
# dom-offscreencanvas-width-dev

Browser compatibility

BCD tables only load in the browser

See also