I'm trying to get my canvas to fit the page, when i do:
ctx.canvas.width = window.innerWidth;
ctx.canvas.height = window.innerHeight;
It goes just over horizontally and vertically which is adding scroll bars. the size its going over is about the size of the scroll bars are being accounted for before they're even there (just a guess) is this whats happening, how would I go about getting it to fit the page with no scrollbars.
Set the the canvas position to
absolute
. Also make sure there is no padding, or margins set in the containing element.This is what I use on all of my full screen canvas demos.
Full Screen Demo
The canvas by default is set to
display: inline-block
. Change it todisplay: block
This worked for me
I had the same problem, and I solved it by removing the
border
.