Paweł Łaba
commited on
Commit
·
be890f4
1
Parent(s):
28e0fe8
zmiany w index
Browse files- static/index.html +38 -0
- static/style.css +53 -0
static/index.html
CHANGED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>TikTacToe</title>
|
7 |
+
</head>
|
8 |
+
<body>
|
9 |
+
<div class="container">
|
10 |
+
<h1>Kółko i Krzyżyk</h1>
|
11 |
+
<div class="board">
|
12 |
+
<div class="cell"></div>
|
13 |
+
<div class="cell"></div>
|
14 |
+
<div class="cell"></div>
|
15 |
+
<div class="cell"></div>
|
16 |
+
<div class="cell"></div>
|
17 |
+
<div class="cell"></div>
|
18 |
+
<div class="cell"></div>
|
19 |
+
<div class="cell"></div>
|
20 |
+
<div class="cell"></div>
|
21 |
+
</div>
|
22 |
+
</div>
|
23 |
+
|
24 |
+
<script>
|
25 |
+
let currentPlayer = 'x';
|
26 |
+
const cells = document.querySelectorAll('.cell');
|
27 |
+
|
28 |
+
cells.forEach(cell => {
|
29 |
+
cell.addEventListener('click', () => {
|
30 |
+
if (!cell.classList.contains('x') && !cell.classList.contains('o')) {
|
31 |
+
cell.classList.add(currentPlayer);
|
32 |
+
currentPlayer = currentPlayer === 'x' ? 'o' : 'x';
|
33 |
+
}
|
34 |
+
});
|
35 |
+
});
|
36 |
+
</script>
|
37 |
+
</body>
|
38 |
+
</html>
|
static/style.css
CHANGED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.board {
|
2 |
+
display: grid;
|
3 |
+
grid-template-columns: repeat(3, 100px);
|
4 |
+
grid-template-rows: repeat(3, 100px);
|
5 |
+
gap: 5px;
|
6 |
+
background-color: #34495e;
|
7 |
+
padding: 10px;
|
8 |
+
border-radius: 10px;
|
9 |
+
width: fit-content;
|
10 |
+
margin: 50px auto;
|
11 |
+
}
|
12 |
+
|
13 |
+
.cell {
|
14 |
+
background-color: #ecf0f1;
|
15 |
+
border-radius: 5px;
|
16 |
+
display: flex;
|
17 |
+
justify-content: center;
|
18 |
+
align-items: center;
|
19 |
+
font-size: 40px;
|
20 |
+
font-family: Arial, sans-serif;
|
21 |
+
cursor: pointer;
|
22 |
+
transition: background-color 0.3s;
|
23 |
+
}
|
24 |
+
|
25 |
+
.cell:hover {
|
26 |
+
background-color: #bdc3c7;
|
27 |
+
}
|
28 |
+
|
29 |
+
.x::before {
|
30 |
+
content: "X";
|
31 |
+
color: #e74c3c;
|
32 |
+
}
|
33 |
+
|
34 |
+
.o::before {
|
35 |
+
content: "O";
|
36 |
+
color: #3498db;
|
37 |
+
}
|
38 |
+
|
39 |
+
h1 {
|
40 |
+
text-align: center;
|
41 |
+
color: #2c3e50;
|
42 |
+
font-family: Arial, sans-serif;
|
43 |
+
}
|
44 |
+
|
45 |
+
.container {
|
46 |
+
display: flex;
|
47 |
+
flex-direction: column;
|
48 |
+
align-items: center;
|
49 |
+
padding: 20px;
|
50 |
+
background-color: #f5f6fa;
|
51 |
+
min-height: 100vh;
|
52 |
+
margin: 0;
|
53 |
+
}
|