-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
93 lines (84 loc) · 2.33 KB
/
index.html
File metadata and controls
93 lines (84 loc) · 2.33 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<!DOCTYPE html>
<html>
<head>
<title>Snake Game</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
margin: 0;
padding: 0;
}
#game-container {
position: absolute;
width: 100vw;
height: 100vh;
background-color: #eee;
}
#canvas {
display: block;
margin: 0 auto;
/* margin-top: 160px; */
border: 0.1em solid black;
border-radius: 5px;
box-shadow: 0 0 5px #333;
box-sizing: border-box;
max-width: calc(100% - 2em);
max-height: calc(100% - 2em);
position: absolute;
top: 150px;
/* top: calc(50% + 150px); */
left: 50%;
transform: translate(-50%, 10%);
}
#score-board {
position: absolute;
top: 50%;
right: 0;
transform: translateY(-50%);
padding: 1em;
background-color: #eee;
border-radius: 5px;
box-shadow: 0 0 5px #333;
max-height: calc(150px - 2em);
max-width: calc(200px - 2em);
}
@media screen and (max-width: 820px) {
#score-board {
position: absolute;
top: 0em;
left: 50%;
transform: translateX(-50%);
text-align: center;
}
}
#pause-button {
position: absolute;
top: 1.5em;
right: 1.5em;
padding: 0.5em 1em;
background-color: #ccc;
border: none;
border-radius: 5px;
box-shadow: 0 0 5px #333;
font-size: 1em;
cursor: pointer;
}
#pause-button:hover {
background-color: #ddd;
}
</style>
</head>
<body>
<div id="game-container">
<div id="score-board">
<h3>Score</h2>
<p id="score">Score: 0</p>
<p id="high-score">Highest Score: 0</p>
</div>
<canvas id="canvas" width="400" height="400"></canvas>
<button id="pause-button">Pause</button>
</div>
<script src="snake.js"></script>
</body>
</html>