title: How to center canvas javascript?
body: <p>I'm having trouble trying to figure out how to center the canvas in the page.  The canvas's code is in a javascript file.  Here's the html for the page.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
     &lt;head&gt;
         &lt;meta charset="utf-8"&gt;
         &lt;title&gt;Game Tut&lt;/title&gt;
     &lt;/head&gt;
     &lt;body&gt;
  
         &lt;script src="game.js"&gt;&lt;/script&gt;
     &lt;/body&gt;
   &lt;/html&gt;
  </code></pre>
  
  <p>I've tried something like this in the javascript file.</p>
  
  <pre><code>var canvas = document.createElement("canvas");
  canvas.width = 800;
  canvas.height = 600;
  canvas.tabindex = 0;
  canvas.style = "position: absolute; top: 50px; left: 50px; border:2px solid blue"
  document.addEventListener('keydown', doKeyDown, true);
  var ctx = canvas.getContext("2d");
  document.body.appendChild(canvas);
  </code></pre>
  
  <p>For some reason the blue border or the positioning don't seem to show up in Google Chrome.</p>