Skip to content

Instantly share code, notes, and snippets.

@hendriklammers
Created September 20, 2012 14:46
Show Gist options
  • Save hendriklammers/3756354 to your computer and use it in GitHub Desktop.
Save hendriklammers/3756354 to your computer and use it in GitHub Desktop.
html: Canvas starter page
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Canvas</title>
<style>
* {
margin: 0;
padding: 0;
}
html, body {
height: 100%;
width: 100%;
}
canvas {
display: block;
margin: 0 auto;
}
</style>
</head>
<body>
<canvas id="my-canvas" width="760" height="500"></canvas>
<script>
(function() {
var canvas = document.getElementById('my-canvas'),
context;
if (canvas.getContext) {
context = canvas.getContext('2d');
} else {
alert('You need a modern browser to view this');
}
})();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment