Home › HTML Tutorial › HTML canvas
HTML canvas
Draw with JavaScript.
The canvas element is a bitmap you paint with the 2D context: shapes, text and images.
Example code
<canvas id='c' width='260' height='120' style='border:1px solid #888'></canvas>
<script>
const g=c.getContext('2d');
g.fillStyle='#2e86de';g.fillRect(10,10,100,60);
g.beginPath();g.arc(190,60,40,0,7);g.fillStyle='tomato';g.fill();
</script>'