Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> #canvas { background: #59b8de; width: 250; height: 150; } </style> </head> <body> <canvas id="canvas"></canvas> <script> var canvas = document.getElementById("canvas"); var context = canvas.getContext("2d"); context.fillStyle = "white"; context.font = "bold 18px Arial"; context.fillText("Text", (canvas.width / 2) - 17, (canvas.height / 2) + 8); </script> </body> </html>