-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstyle.css
186 lines (161 loc) · 3.33 KB
/
style.css
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
html {
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
background-color: #F9FBFC;
color: #FF6652;
font-family: 'Open Sans', sans-serif;
}
*,
*:before,
*:after {
box-sizing: inherit;
-webkit-box-sizing: inherit;
-moz-box-sizing: inherit;
}
body {
display: grid;
justify-content: center;
align-items: center;
min-height: 95vh;
text-align: center;
}
.board {
display: grid;
grid-template-columns: repeat(3, auto);
margin: 30px auto 40px auto;
}
.square {
width: 100px;
height: 100px;
border: 2px solid #FF6652;
transition: 0.2s ease-out;
cursor: pointer;
position: relative;
}
/* change color of square when hovering */
.square:hover {
background-color: #C7E3EE;
}
/* to disable the hover effect when a square is already selected
or when the game is over */
.gameOver .square:hover,
.square.X:hover,
.square.O:hover {
background-color: inherit;
cursor: default;
}
/* display outline and foreground overlapping and center contents */
.square .outline {
position: absolute;
display: flex;
justify-content: center;
align-items: center;
height: 100px;
width: 100px;
}
.square .foreground {
position: absolute;
display: flex;
justify-content: center;
align-items: center;
height: 100px;
width: 100px;
}
/* outline and foreground of a square with X */
.square.X .outline:before {
content: "";
background: #FC1D00;
width: 14px;
height: 58px;
position: absolute;
transform: rotate(45deg);
z-index: 2;
}
.square.X .outline:after {
content: "";
background: #FC1D00;
width: 14px;
height: 58px;
position: absolute;
transform: rotate(-45deg);
z-index: 2;
}
.square.X .foreground:before {
content: "";
background: #FF6652;
width: 8px;
height: 52px;
position: absolute;
transform: rotate(45deg);
z-index: 3;
}
.square.X .foreground:after {
content: "";
background: #FF6652;
width: 8px;
height: 52px;
position: absolute;
transform: rotate(-45deg);
z-index: 3;
}
/* outline and foreground of a square with O */
.square.O .outline:before {
content: "";
background: transparent;
width: 58px;
height: 58px;
position: absolute;
border-radius: 50%;
border: 14px solid #C54D3D;
z-index: 2;
}
.square.O .foreground:after {
content: "";
background: transparent;
width: 52px;
height: 52px;
position: absolute;
border-radius: 50%;
border: 8px solid #F0D1CD;
z-index: 3;
}
/* hide outer borders of the squares */
.square:nth-of-type(1),
.square:nth-of-type(2),
.square:nth-of-type(3) {
border-top: none;
}
.square:nth-of-type(1),
.square:nth-of-type(4),
.square:nth-of-type(7) {
border-left: none;
}
.square:nth-of-type(3),
.square:nth-of-type(6),
.square:nth-of-type(9) {
border-right: none;
}
.square:nth-of-type(7),
.square:nth-of-type(8),
.square:nth-of-type(9) {
border-bottom: none;
}
/* new game button */
button {
background-color: #0B033C;
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: white;
border: none;
padding: 15px 30px;
border-radius: 4px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.16), 0 2px 5px rgba(0, 0, 0, 0.26);
transition: 0.2s ease-out;
cursor: pointer;
}
/* change color and shadow of button when hovering */
button:hover {
background-color: #05011C;
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.16), 0 5px 6px rgba(0, 0, 0, 0.26);
}