Advertisement
Home Open Editor ❯

HTML <canvas> width Attribute

Example

<canvas id="myCanvas" width="100" height="100">
  Your browser does not support the HTML5 canvas tag.
</canvas>

Try this code ❯

Meaning

The width attribute specifies the width of the <canvas> element (in pixels only).


Standard Syntax

<canvas width="pixels">


Advertisement

Attribute Values

Value Description
pixels Specifies the width of the canvas (in pixels only), by default height is 100
Home Open Editor ❯
Advertisement