The second argument is the Y coordinate for the text baseline (by default textBaseline is "alphabetic" ), so the text is used over the visible canvas when using 0 .
jsFiddle .
You can use a different number or, alternatively, change the textBaseline property to something suitable, for example, "top" .
ctx.textBaseline = "top";
jsFiddle .
source share