Files
JavaScript-from-Beginner-to…/Chapter 13/ch13-canvas.html
T
2021-09-04 21:22:51 +02:00

21 lines
415 B
HTML
Executable File

<html>
<head>
<style>
canvas {
border: 1px solid black;
}
</style>
</head>
<body>
<canvas id="c1"></canvas>
<script>
let canvas = document.getElementById("c1");
let ctx = canvas.getContext("2d");
canvas.width = 500; //px
canvas.height = 500; //px
//ctx.fillStyle = "pink";
ctx.fillRect(20, 40, 100, 100);
</script>
</body>
</html>