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">
<head>
<meta charset="utf-8">
<title>HTML5 Canvas template</title>
<style>
canvas{
border: 1px solid #999999;
}
</style>
<script>
function init(){
var context= document.getElementById('canvas').getContext('2d');
}
</script>
</head>
<body onload="init()">
<canvas id="canvas" width="800" height="600"></canvas>
</body>
</html>



0 comments:
Post a Comment