Code
Execute
<!DOCTYPE html> <html> <body> <head> <title>Wikitechy-HTML Canvas strokeText</title> </head> <body> <h1>Wikitechy HTML Canvas strokeText() with example:</h1> <canvas id="wikitechyCanvas" width="400" height="200" style="border:1px solid #d3d3d3;"> </canvas> <script> var d = document.getElementById("wikitechyCanvas"); var mtx = d.getContext("2d"); mtx.font = "25px Arial"; mtx.strokeText("Welcome To!", 50, 80); mtx.font = "40px georgia"; var gra = mtx.createLinearGradient(0, 0, d.width, 0); gra.addColorStop("0", "green"); gra.addColorStop("0.5", "red"); gra.addColorStop("1", "blue"); mtx.strokeStyle = gra; mtx.strokeText("Wikitechy!", 50, 150); </script> </body> </html>
Result