HTML5
HTML5 캔버스로 사각형을 그리려면 fillRect(x, y, width, height) 메서드를 사용하세요.

다음 코드를 실행하여 HTML5 Canvas로 사각형을 그리는 방법을 배울 수 있습니다.
예시
<!DOCTYPE html>
<html>
<head>
<title>HTML5 Canvas Tag</title>
</head>
<body>
<canvas id="newCanvas" width="200" height="100" style="border:1px
solid #000000;"></canvas>
<script>
var c = document.getElementById('newCanvas');
var ctx = c.getContext('2d');
ctx.fillStyle = '#7cce2b';
ctx.fillRect(0,0,300,100);
</script>
</body>
</html> 출력
