Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
62 lines (57 loc) · 1.48 KB
/
Copy pathindex.html
File metadata and controls
62 lines (57 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flappy Bird</title>
<style>
/* 修改后的CSS */
body, html {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
display: flex;
background-color: #000;
}
#main {
border: 2px solid red;
width: 100vw;
height: 100vh;
display: flex;
flex: 1; /* 新增 */
background: #1a1a1a;
}
#left, #right {
border: 2px solid red;
min-width: 320px;
background: #333;
padding: 1rem;
flex-shrink: 0; /* 防止侧边栏被压缩 */
}
#game-container {
flex: 1; /* 关键修改:占据剩余空间 */
position: relative;
overflow: hidden;
/* 移除 width/height 设置 */
/* 移除 display:flex 和居中属性 */
}
#canvas {
width: 100% !important; /* 强制填满 */
height: 100% !important;
display: block;
background: #000;
}
</style>
</head>
<body>
<div id="main">
<div id="left"></div>
<div id="game-container" >
<canvas id="canvas"></canvas>
</div>
<div id="right"></div>
</div>
<script src="flappyBird.js"></script>
</body>
</html>