JSFiddle - React, Tailwind, and code Playground
by loktar
HTML
<canvas id="canvas"></canvas>
CSS
canvas{border:1px solid #000;}
JavaScript
var canvas = document.getElementById("canvas"),
ctx = canvas.getContext("2d")
canvas.width = 400;
canvas.height = 200;
ctx.fillStyle = "#003300";
ctx.font = '20px san-serif';
var textString = "Hello look at me!!!",
textWidth = ctx.measureText(textString ).width;
ctx.fillText(textString , (canvas.width/2) - (textWidth / 2), 100);