强制canvas元素在html中占据整个窗口? [英] Force canvas element in html to take up the entire window?

查看:89
本文介绍了强制canvas元素在html中占据整个窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

而不是

<pre>
    <canvas id="theCanvas" width="500" height="500"></canvas>
</pre> 

其中,我指定canvas的大小是有办法让canvas占用整个浏览器窗口?

where I specify the size of the canvas is there a way to make the canvas take up the entire browser window?

推荐答案

<html>
  <body style="height: 100%; margin: 0;">
    <canvas style="width: 100%; height: 100%;"></canvas>
  </body>
</html>

这篇关于强制canvas元素在html中占据整个窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆