You must set the width and height manually.
This can be done using the JavaScript onresize event - this is great because you almost always have to redraw the canvas surface onresize anyway.
EDIT:
From the W3 spec, here is the canvas DOM interface:
http://www.w3.org/TR/html5/the-canvas-element.html
interface HTMLCanvasElement : HTMLElement { attribute unsigned long width; attribute unsigned long height; DOMString toDataURL(in optional DOMString type, in any... args); void toBlob(in FileCallback, in optional DOMString type, in any... args); object getContext(in DOMString contextId, in any... args); };
The canvas element has two attributes for controlling the size of the coordinate space: width and height. These attributes, if specified, must have values ββthat are real non-negative integers. Rules for parsing non-negative integers should be used to obtain their numerical values. If the attribute is missing, or if parsing its value returns an error, then use the default value instead. The default attribute width is 300, and the default height attribute is 150.
Steve source share