简体   繁体   中英

How to set canvas height to be Full Document height (Cover the whole page)

Heyy all,

Just getting ready for xmas so I had some snow falling using the Canvas and it looks really cool, although it is only fulling up via 100vh due to:

c.width = innerWidth;
c.height = innerHeight;

So if someone could help me out here I would much appreciate it =)

I have tried using via CSS:

canvas#c {
position: absolute;
z-index: 999;
bottom: 1px;
top: 1px;
height: 100%;}

For anyone who cares, I changed from position: absolute; to position: fixed;

Now it just stays in the screen looking like its snowing =)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM