today i used this video
Build Your Own Snake Game: A Step-by-Step HTML, CSS, and JavaScript Guide
what i got so far for html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="game-container">
<canvas id="gameCanvas"></canvas>
<div class="score">Score: <span id="score">0</span></div>
<button id="restartbtn" onclick="resetGame()">restart</button>
</div>
<script src="script.js"></script>
</body>
</html>
for styles.css
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: antiquewhite;
color: #000;
font-family: 'Courier New', Courier, monospace;
}
.game-container {
display: flex;
flex-direction: column;
align-items: center;
background-color: #000;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 20px (0, 0, 0, 0.5);
}
canvas {
border: 5px solid;
background-color: #000;
border-radius: 5px;
}
.score{
margin-top: 20px;
}