JSFiddle - React, Tailwind, and code Playground

by BYossarian

HTML

<canvas id="canvas1" style="width: 50px; height: 100px;" height="50" width="100"></canvas>
<canvas id="canvas2" style="width: 100px; height: 100px;" height="50" width="100"></canvas>

CSS

canvas {
    border: 1px solid black;
}

JavaScript

var ctx = document.getElementById('canvas1').getContext('2d');
    ctx.fillStyle = "red";
    ctx.fillRect(10, 10, 30, 30);

    var ctx2 = document.getElementById('canvas2').getContext('2d');
    ctx2.fillStyle = "red";
    ctx2.fillRect(10, 10, 30, 30);