HTML and CSS Reference
In-Depth Information
height=" number
number "
Specifies the height of the canvas area in CSS pixels.
width=" number
number "
Specifies the width of the canvas area in CSS pixels.
Example
<html>
<head>
<script type="application/x-javascript">
function draw() {
var canvas = document.getElementById(" box ");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "rgb(163, 120, 240)";
ctx.fillRect (55, 50, 75, 100);
}
</script>
</head>
<body onload="draw()">
<canvas id="box" width="250" height="250"></canvas>
</body>
</html>
Search WWH ::




Custom Search