-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstyles.css
More file actions
148 lines (141 loc) · 3.87 KB
/
Copy pathstyles.css
File metadata and controls
148 lines (141 loc) · 3.87 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
141
142
143
144
145
146
147
148
*, *::after, *::before {
box-sizing: border-box;
}
:root {
--cell-size: 100px;
--mark-size: calc(var(--cell-size) * .9);
}
/* The entire body of the page */
body {
margin: 0;
}
/* the board where the grids will be stored, the game takes place here */
.board {
width: 100vw;
height: 100vh;
display: grid;
justify-content: center;
align-content: center;
justify-items: center;
align-items: center;
grid-template-columns: repeat(3, auto);
}
/* the cells or the board where the x's or o's will be stored */
.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;
}
/* the top 3 rows of the grid, the rules here will take the top of the 3x3 grid away */
.cell:first-child,
.cell:nth-child(2),
.cell:nth-child(3) {
border-top: none;
}
/* left side of the grid with no border */
.cell:nth-child(3n + 1){
border-left: none;
}
/* right side of the grid with no border*/
.cell:nth-child(3n + 3) {
border-right: none;
}
/* the bottom 3 rows of the grid, the rules here will take the bottom of the 3x3 grid away */
.cell:last-child,
.cell:nth-child(8),
.cell:nth-child(7) {
border-bottom: none;
}
/* when there is a x or o in the cell the cursor will not be allowed */
.cell.x,
.cell.circle {
cursor: not-allowed;
}
.cell.x::before,
.cell.x::after,
.cell.circle::before {
background-color: coral;
}
/*if the cell is not occupied let a lightly colored x or o show what cell you are in to show what the choice is*/
.board.x .cell:not(.x):not(.circle):hover::before,
.board.x .cell:not(.x):not(.circle):hover::after,
.board.circle .cell:not(.x):not(.circle):hover::before {
background-color: lightcoral;
}
.cell.x::before,
.cell.x::after,
.board.x .cell:not(.x):not(.circle):hover::before,
.board.x .cell:not(.x):not(.circle):hover::after {
content: '';
width: calc(var(--mark-size) * .15);
height: var(--mark-size);
position: absolute;
}
/* one of the lines to make the x that will populate a cell*/
.cell.x::before,
.board.x .cell:not(.x):not(.circle):hover::before{
transform: rotate(45deg);
}
/* one of the lines to make the x that will populate a cell*/
.cell.x::after,
.board.x .cell:not(.x):not(.circle):hover::after {
transform: rotate(-45deg);
}
/* the circle itself and how it would it displayed in the cells */
.cell.circle::before,
.cell.circle::after,
.board.circle .cell:not(.x):not(.circle):hover::before,
.board.circle .cell:not(.x):not(.circle):hover::after {
content: '';
position: absolute;
border-radius: 50%;
}
.cell.circle::before,
.board.circle .cell:not(.x):not(.circle):hover::before {
width: var(--mark-size);
height: var(--mark-size);
}
.cell.circle::after,
.board.circle .cell:not(.x):not(.circle):hover::after {
width: calc(var(--mark-size) * .7);
height: calc(var(--mark-size) * .7);
background-color: white;
}
/* how the winning message will be shown*/
.winning-message {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(0, 0, 0, .7);
justify-content: center;
align-items: center;
color: white;
font-size: 5rem;
flex-direction: column;
}
/* the winning message button*/
.winning-message button {
font-size: 3rem;
background-color: white;
border: 1px solid black;
padding: .25em .5em;
cursor: pointer;
}
/* the winning message button when hovered over */
.winning-message button:hover {
background-color: black;
color: white;
border-color: white;
}
/* when the winning message is shown */
.winning-message.show {
display: flex;
}