admin管理员组文章数量:1356244
I made a game that sets the width and height of the canvas as window.innerWidth and window.innerHeight, respectively. In theory, this should make it flush with the sides, yet I get scrollbars and a 4 pixel height blank to the bottom of the page. I set the margins and paddings to * as 0, thinking that would solve it, yet it's still like that.
I need to use the least amount of code as possible; this is for a future js1k po.
Here's a screenie of the page Top-Left Scrolled Image, Bottom-Right Scrolled Image.
Any ideas on what is wrong or on how to fix it?
I made a game that sets the width and height of the canvas as window.innerWidth and window.innerHeight, respectively. In theory, this should make it flush with the sides, yet I get scrollbars and a 4 pixel height blank to the bottom of the page. I set the margins and paddings to * as 0, thinking that would solve it, yet it's still like that.
I need to use the least amount of code as possible; this is for a future js1k po.
Here's a screenie of the page Top-Left Scrolled Image, Bottom-Right Scrolled Image.
Any ideas on what is wrong or on how to fix it?
Share Improve this question asked May 9, 2012 at 2:40 TgwizmanTgwizman 1,5482 gold badges19 silver badges34 bronze badges 1-
1
I had the doctype as
<!DOCTYPE html>
, but I added the 5 to the end of html, and now it's all fine :D – Tgwizman Commented May 9, 2012 at 2:48
1 Answer
Reset to default 12You're missing a display: block
for your canvas element, or a <!DOCTYPE html>
- they're inline by default unless you're in html5 mode.
本文标签: javascriptCanvas windowinner(WidthHeight) scrollbar offsetStack Overflow
版权声明:本文标题:javascript - Canvas window.inner(Width|Height) scrollbar offset? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744001556a2573948.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论