1:构建web-desktop版本后,会有一个index.html和styple.css文件
2:打开index.html, 注释掉div前面的h1字段和后面的p字段
3:在id为GameDiv的div外面封装多一层div
<div id="OutDiv">
<div id="GameDiv" style="width:1024px; height: 576px;">
<canvas id="GameCanvas" width="1024" height="576"></canvas>
<div id="splash">
<div class="progress-bar stripes">
<span style="width: 0%"></span>
</div>
</div>
</div>
4:修改styple.css文件,添加新增的div样式
#OutDiv {
width: 100%;
height: 100%;
position: absolute;
}
修改GameDiv样式
#GameDiv {
width: 800px;
height: 450px;
margin: 0 auto;
background: black;
/*position: relative;*/
border: 3px solid black;
border-radius: 6px;
box-shadow: 0 5px 40px #333;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}