JSFiddle - React, Tailwind, and code Playground
HTML
<canvas id="myCanvas"></canvas>
CSS
canvas {
width:300px;
height:300px;
background-color:#ffffff;
}
JavaScript
function close_button(x,y,side){
ctx.fillStyle="red";
ctx.fillRect(x, y, side, side);
var shift = side/10;
ctx.beginPath();
ctx.moveTo(x + shift, y + shift);
ctx.lineTo(x + side - shift, y + side - shift);
ctx.moveTo(x + side - shift, y + shift);
ctx.lineTo(x + shift, y + side - shift);
ctx.strokeStyle = '#FFFFFF';
ctx.stroke();
}
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
c.width = 300;
c.height = 300;
close_button(10, 10, 20);