JSFiddle - React, Tailwind, and code Playground

by FGRibreau

HTML

<canvas id="myCanvas"></canvas>

CSS

body{
  background:black
}

JavaScript

var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");

const FONT_HEIGHT = 20;
ctx.font = `${FONT_HEIGHT}px Georgia`;
//ctx.font = FONT_HEIGHT + 'px Georgia';
ctx.textAlign = 'right';
ctx.fillStyle = 'rgba(255,255,255,1)';
const text = "Hello World!";
const measure = ctx.measureText(text);
ctx.fillText(text, c.width, FONT_HEIGHT);