JSFiddle - React, Tailwind, and code Playground

by smithkl42

HTML

<div style="height: 200px; width:200px; background-color:blue">
<canvas height="50" width="100" id="canvas">
</div>

CSS

canvas {max-width: 100%; max-height: 100%;}

JavaScript

var canvas = document.getElementById('canvas');
	if (canvas.getContext) {
		var ctx = canvas.getContext("2d");

		ctx.fillStyle = "rgb(200,0,0)";
		ctx.fillRect(0, 0, 200, 100);
	}