스크립트로 그래픽을 만들려면
다음은
| 속성 | 값 | 설명 |
|---|---|---|
높이 | 픽셀 | 캔버스의 높이를 지정합니다. |
폭 | 픽셀 | 캔버스의 너비를 지정합니다. |
예시
다음 코드를 실행하여
<!DOCTYPE html>
<html>
<head>
<title>HTML Canvas Tag</title>
</head>
<body>
<canvas id = "newCanvas">Your browser does not support canvas tag.</canvas>
<script>
var c = document.getElementById('newCanvas');
var ctx = c.getContext('2d');
ctx.fillStyle = '#00AEEF';
ctx.fillRect(0,0,180,50);
</script>
</body>
</html>