View Full Version : Full page canvas problem

02-25-2011, 11:13 AM
This may be stupid but I can't seem to get my canvas to fill the whole webpage. I create the canvas with

<body onload="webGLStart();">

<script type="text/javascript">
var X = document.body.clientWidth;
var Y = document.body.clientHeight;
document.write('<canvas id="test" style="border: none;" width="'+X+'" height="'+Y+'"></canvas>')


but I always have scroll bars and the canvas doesn't start at the very top left. There is a little gap. Any ideas?

02-25-2011, 12:40 PM
You have to play with css, try something like this:

body {
margin: 0;
padding: 0;

#test {
margin: 0;
padding: 0;

02-25-2011, 12:58 PM
Ah, worked like a charm. Thanks a lot.