xxxxxxxxxx
<html>
<head>
<script>
var canvas = document.querySelector("canvas");
var ctx = canvas.getContext("2d");
ctx.fillStyle = "red"; // Sets the color
ctx.fillRect(50, 50, 180, 180);
/*
The first two numbers set the start position (x, y).
The second two numbers set the width and height.
*/
</script>
</head>
<body>
<h1>Basic canvas element example</h1>
<canvas width="500" height="300"> A red rectangle. </canvas>
</body>
</html>