Repository navigation
Expand file tree
/
Copy pathindex.css
More file actions
140 lines (138 loc) · 2.76 KB
/
Copy pathindex.css
File metadata and controls
140 lines (138 loc) · 2.76 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
:root {
--cell-size: 100px;
--mark-size: calc(var(--cell-size) * 0.9);
}
.board {
width: 100%;
height: 100vh;
display: grid;
justify-content: center;
justify-items: center;
align-content: center;
align-items: center;
grid-template-columns: repeat(3, auto);
}
.cell.x::before,
.cell.x::after {
background-color: black;
}
.cell.o::before,
.cell.o::after {
border: 7px solid black;
}
.board.x .cell:not(.x):not(.o):hover::before,
.board.x .cell:not(.x):not(.o):hover::after {
background-color: lightgrey;
}
.board.o .cell:not(.x):not(.o):hover::before,
.board.o .cell:not(.x):not(.o):hover::after {
border: 10px solid lightgray;
}
.cell {
width: var(--cell-size);
height: var(--cell-size);
border: 1px solid black;
display: flex;
justify-content: center;
align-items: center;
position: relative;
cursor: pointer;
}
.cell.x,
.cell.o {
cursor: not-allowed;
}
.cell:first-child,
.cell:nth-child(2),
.cell:nth-child(3) {
border-top: none;
}
.cell:nth-child(7),
.cell:nth-child(8),
.cell:nth-child(9) {
border-bottom: none;
}
.cell:nth-child(1),
.cell:nth-child(4),
.cell:nth-child(7) {
border-left: none;
}
.cell:nth-child(3n) {
border-right: none;
}
.cell.x::before,
.cell.x::after,
.board.x .cell:not(.x):not(.o):hover::before,
.board.x .cell:not(.x):not(.o):hover::after {
content: "";
position: absolute;
width: calc(var(--mark-size) * 0.15);
height: var(--mark-size);
/* background-color: black; */
}
.cell.x::before,
.board.x .cell:not(.x):not(.o):hover::before {
transform: rotate(45deg);
}
.cell.x::after,
.board.x .cell:not(.x):not(.o):hover::after {
transform: rotate(-45deg);
}
.cell.o::before,
.cell.o::after,
.board.o .cell:not(.x):not(.o):hover::before,
.board.o .cell:not(.x):not(.o):hover::after {
content: "";
position: absolute;
background-color: transparent;
width: calc(var(--mark-size) * 0.8);
height: calc(var(--mark-size) * 0.8);
/* border: 10px solid black; */
border-radius: 50%;
}
/* other way to draw empty inner circle
.cell.o::before {
width: var(--mark-size);
height: var(--mark-size);
background-color: black;
}
.cell.o::after {
width: calc(var(--mark-size) * 0.8);
height: calc(var(--mark-size) * 0.8);
background-color: white;
}
*/
.winning-message {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.8);
justify-content: center;
align-items: center;
color: white;
font-size: 30px;
flex-direction: column;
}
#restartBtn {
font-size: 28px;
background-color: white;
border: 1px solid black;
padding: 5px 10px;
cursor: pointer;
}
#restartBtn:hover {
background-color: black;
color: white;
border-color: white;
}
.winning-message.show {
display: flex;
}