Sunday, 22 May 2011

HTML5 Canvas template

I’ve been playing around with the HTML5 canvas element recently, and have been copying and pasting the same HTML tags every time I create a new document. So I have written this quick and dirty template to get me started faster. I have also included a 1 pixel border around the canvas, so the edges can be seen.

<!DOCTYPE html>
<html lang="en">
 <meta charset="utf-8">
 <title>HTML5 Canvas template</title>

   border: 1px solid #999999;
  function init(){
   var context= document.getElementById('canvas').getContext('2d');
<body onload="init()">
 <canvas id="canvas" width="800" height="600"></canvas> 



  COPYRIGHT © 2014 · ILIKE2FLASH · Theme by Ourblogtemplates

Back to TOP