canvas problems
So, I was online looking at how to make a canvas fit the page and i managed to gather enough knowledge to make one but obviously not without a flaw. I set the canvas to the colour red but it didn't work and displayed the colour black. Please help. Here is the code: <!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <style>body>{margin:0:}</style> <canvas id='ltpcanvas'></canvas> <script> window.onload = function(){ init(); window.addEventListener('resize', init,false); } function init(){ var ltpc = document.getElementById('ltpcanvas'); var context = ltpc.getContext('2d'); var myWidth = window.innerWidth -30; var myHeight = window.innerHeight -30; context.canvas.width = myWidth; context.canvas.height = myHeight; context.filStyle = "#FF0000"; context.fillRect(0,0,myWidth,myHeight); } </script> </body> </html>