all articles

canvas cannot have exact size to fullscreen

2015-07-05 @sunderls

canvas fullscreen scrollbar display_block js

desc

if <canvas> is set to window's size to make it fullscreen, it will leave us with a disturbing scrollbar.

the html and body tag has no padding or margin, so why is this happening ?

I don't know, but I just know this is solved if you set canvas to display:block. It looks like <canvas> element has some strange behavior in default display.

code

remmeber add this to <canvas>

canvas {
     display: block
}

jsfiddle

https://jsfiddle.net/3y10yhoj/1/