Watch a demo of different values of the textAlign property.
Or click a specific value to see the result:
const c = document.getElementById('myCanvas'); const ctx = c.getContext('2d'); ctx.strokeStyle='red'; ctx.moveTo(150,20); ctx.lineTo(150,100); ctx.stroke(); ctx.textAlign='end'; ctx.fillText('Hello World',150,50);