【发布时间】:2015-09-09 20:21:40
【问题描述】:
我创建了一个 cocos2d-javascript 游戏,并正在 Chrome 上对其进行测试。网页的 HTML 是
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Testing</title>
<link rel="icon" type="image/GIF" href="res/favicon.ico"/>
<meta name="viewport" content="width=100%, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="full-screen" content="yes"/>
<meta name="screen-orientation" content="landscape"/>
<meta name="x5-fullscreen" content="true"/>
<meta name="360-fullscreen" content="true"/>
<style>
body, canvas, div {
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
-khtml-user-select: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
width: 100%;
height: 100%;
margin: 0px;
}
</style>
</head>
<body style="padding:0; margin: 0; background: #000; width:100%; height:100%; margin: 0px;">
<script src="res/loading.js"></script>
<canvas id="gameCanvas" width="100%" height="100%"></canvas>
<script src="frameworks/cocos2d-html5/CCBoot.js"></script>
<script cocos src="main.js"></script>
</body>
</html>
如您所见,我设置它以使画布适合整个页面。这就是游戏的外观(默认为 500x500):
如果我调整窗口大小,画布通常会正确调整大小。但有时会有某种排序或边距:
怎么了?我想问题是 HTML 本身,而不是 cocos2d。
这似乎只发生在 Chrome 上。 Firefox 看起来不错。
我正在使用 Mac OSX Yosemite。
【问题讨论】:
标签: html css google-chrome cocos2d-js