如何使 Canvas 在页面的宽度和高度上达到 100%?
最佳答案
我让它在这里工作:Are Google's Bouncing Balls HTML5?通过使用以下 CSS:
* { margin: 0; padding: 0;}
body, html { height:100%; }
#c {
position:absolute;
width:100%;
height:100%;
}
其中 #c 是 Canvas 元素的 ID。
关于javascript - 让 Canvas 填满整个页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3707151/