Careeroza
Canvas
The canvas Element
<canvas> is a drawing surface. It is only a container; the drawing is done with JavaScript, pixel by pixel. It is used for charts, games and image editing.
Draw Shapes and Text
Example
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<canvas id="c" width="320" height="140" style="border:1px solid #ccc"></canvas>
<script>
const ctx = document.getElementById('c').getContext('2d');
ctx.fillStyle = '#04AA6D';
ctx.fillRect(20, 20, 100, 60); // rectangle
ctx.beginPath();
ctx.arc(190, 50, 30, 0, Math.PI * 2); // circle
ctx.fillStyle = '#ff6b6b';
ctx.fill();
ctx.font = '20px Arial';
ctx.fillStyle = '#282A35';
ctx.fillText('Hello Canvas', 20, 120);
</script>
</body>
</html>Result