Skip to content

Commit

Permalink
2048
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashster committed Feb 23, 2021
0 parents commit d79fa37
Show file tree
Hide file tree
Showing 5 changed files with 632 additions and 0 deletions.
67 changes: 67 additions & 0 deletions 2048/2048.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
body {
font-family: Arial;
}

header {
display: block;
margin: 0 auto;
width: 100%;
text-align: center;
}

header h1 {
font-size: 40px;
font-weight: bold;
}

header #newGameButton {
display: block;
margin: 20px auto;
width: 100px;
padding: 10px;
background-color: #8f7a66;
color: #fff;
border-radius: 10px;
text-decoration: none;
}

header #newGameButton:hover {
background-color: #9f8b77;
}

header p {
font-size: 25px;
margin: 20px auto;
}

#grid-container {
width: 460px;
height: 460px;
padding: 20px;
margin: 50px auto;
background-color: #bbada0;
border-radius: 10px;
position: relative;
left: 0;
top: 0;
}


/* 利用子绝父相来定位 相对定位 绝对定位 */

.grid-cell {
width: 100px;
height: 100px;
border-radius: 6px;
background-color: #ccc0b3;
position: absolute;
}

.number-cell {
border-radius: 6px;
font-weight: bold;
font-size: 60px;
line-height: 100px;
text-align: center;
position: absolute;
}
42 changes: 42 additions & 0 deletions 2048/2048.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, height=device-height,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<title>2048</title>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="main2048.js"></script>
<script type="text/javascript" src="showanimation2048.js"></script>
<script type="text/javascript" src="support2048.js"></script>
<link rel="stylesheet" type="text/css" href="2048.css">
</head>

<body>
<header>
<h1>2048</h1>
<a href="javascript:newgame();" id="newGameButton">New Game</a>
<p>score:<span id="score">0</span></p>
</header>
<div id="grid-container">
<div class="grid-cell" id="grid-cell-0-0"></div>
<div class="grid-cell" id="grid-cell-0-1"></div>
<div class="grid-cell" id="grid-cell-0-2"></div>
<div class="grid-cell" id="grid-cell-0-3"></div>
<div class="grid-cell" id="grid-cell-1-0"></div>
<div class="grid-cell" id="grid-cell-1-1"></div>
<div class="grid-cell" id="grid-cell-1-2"></div>
<div class="grid-cell" id="grid-cell-1-3"></div>
<div class="grid-cell" id="grid-cell-2-0"></div>
<div class="grid-cell" id="grid-cell-2-1"></div>
<div class="grid-cell" id="grid-cell-2-2"></div>
<div class="grid-cell" id="grid-cell-2-3"></div>
<div class="grid-cell" id="grid-cell-3-0"></div>
<div class="grid-cell" id="grid-cell-3-1"></div>
<div class="grid-cell" id="grid-cell-3-2"></div>
<div class="grid-cell" id="grid-cell-3-3"></div>
</div>
</body>

</html>
Loading

0 comments on commit d79fa37

Please sign in to comment.