PDA

View Full Version : Full page canvas problem



p0pes
02-25-2011, 12:13 PM
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>')
</script>

</body>


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

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

body {
margin: 0;
padding: 0;
}

#test {
margin: 0;
padding: 0;
}

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