Blog Design Development Mobile Inspiration CSS Javascript News Opinions Politics Menu

Canvas Cheat Sheet

HTML5 Canvas Cheat Sheet
HTML5 Canvas Text Font, Size, and Style Tutorial

HTML5 Canvas Text Stroke Tutorial

Description

To set the stroke color of text using HTML5 Canvas, we can set the strokeStyle property of the canvas context to a color string, hex value, or RGB value, and then use the strokeText() method to stroke the text.

Note: To set both the fill and stroke for HTML5 canvas text, you must use both the fillText() and strokeText() methods together. It’s good practice to use the fillText() method before the strokeText() method in order to render the stroke thickness correctly.

Demo