JSFiddle - React, Tailwind, and code Playground
HTML
<canvas id="canvas" width="300" height="250" style="background-color: #f1f1f1;"></canvas>
JavaScript
var canvas = document.getElementById("canvas");
var red = canvas.getContext('2d');
function drawRed()
{
red.beginPath();
red.fillStyle = '#af0000';
red.fillRect(33, 33, 200, 60);
red.closePath();
red.beginPath();
red.fillStyle = '#000';
red.fillRect(77, 66, 120, 60);
red.clearRect(110, 80, 20, 20);
red.closePath();
}
drawRed();