Learn more with dummies

Enter your email to join our mailing list for FREE content right to your inbox. Easy!

Understanding the HTML5 Canvas Context

By Don Cowan

Part of HTML5 Canvas For Dummies Cheat Sheet

An HTML-defined web page can have multiple Canvas areas. Each Canvas has an associated context. The ID defined in the <canvas> tag is used in JavaScript code to identify a Canvas and its associated context. Contexts are referenced using dot syntax notation. Here is an example: contextName.save().

getElementById("canvasName")
getContext("2d")
save()
restore()