HTML5 Canvas: Text using strokeText

Similar to fillText, strokeText creates an outline of the text characters.

Its syntax is:

context.strokeText(text,x,y,maxWidth);

<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='utf-8'>
    <title>Codecrawl.com: Text in canvas</title>
    <style>
        canvas {
            border: 1px solid #000;
        }
    </style>
</head>
<body>
<canvas id='canvas' width='650' height='300'></canvas>
<script>
    var canvas = document.getElementById('canvas').getContext('2d');
    canvas.font = 'bold 80px Tahoma';
    canvas.strokeStyle = '#000';
    canvas.lineWidth = 3;
    canvas.strokeText('HTML5 Canvas', 20, 100);
</script>
</body>
</html>


Codecrawl.com: Text in canvas

Series Navigation<< HTML5 Canvas: Text in canvas using fillText
HTML5 Canvas: Filling up outline text >>