Source code
Revision control
Copy as Markdown
Other Tools
<!DOCTYPE html>
<meta charset="utf-8">
<div style="width: 100px; height: 100px;">
<canvas id="c" width="100" height="100"></canvas>
</div>
<script>
var ctx = document.getElementById('c').getContext('2d', { alpha: false });
ctx.fillStyle = 'red';
ctx.fillRect(0, 0, 50, 100);
ctx.fillStyle = 'green';
ctx.fillRect(50, 0, 50, 100);
</script>