-
Notifications
You must be signed in to change notification settings - Fork 0
/
board.css
191 lines (171 loc) · 4.84 KB
/
board.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
187
188
189
190
191
html { font-size: 2vmin; }
/* Responsive/Fluid Fonts
https://www.smashingmagazine.com/2016/05/fluid-typography/
*/
h1 {
font-size: 2rem;
text-align: center;
}
.game-table {
display: grid;
grid-template: 5vmin auto 5vmin / 5vmin auto 5vmin;
justify-content: center;
}
/* CSS Grid of 15 * 15
https://css-tricks.com/snippets/css/complete-guide-grid/#prop-grid-column-row
*/
.game-board{
grid-column: 2 / 3; /* This grid is itself inside another parent grid. So it's second-row, second-column in parent layout */
display: grid;
/* vmins instead of px helps to make the grid resize itself based on the screen size */
grid-template-columns: repeat(15, 5vmin);
grid-template-rows: repeat(15, 5vmin);
justify-content: center;
align-content: center;
box-sizing: border-box;
margin: 0.5vmin;
}
.box, .green, .yellow, .blue, .red {
position: relative;
border: 1px solid black;
height: 5vmin;
width: 5vmin;
line-height: 5vmin;
font-size: 3.5vmin;
text-align: center;
box-sizing: border-box;
}
.green-home{
position: relative;
background-color: white;
width: 30vmin;
height: 30vmin;
box-shadow: 0 0 0 1px black; /* Real Border*/
border: 5vmin solid limegreen; /* Inner square or Inner Border :-) */
box-sizing: border-box;
/* 4 circles as background */
background:
radial-gradient(circle at 25% 25%,limegreen 3vmin, transparent 0),
radial-gradient(circle at 25% 75%,limegreen 3vmin, transparent 0),
radial-gradient(circle at 75% 25%,limegreen 3vmin, transparent 0),
radial-gradient(circle at 75% 75%,limegreen 3vmin, transparent 0);
grid-column-start: 1;
grid-column-end: 7;
grid-row-start: 1;
grid-row-end: 7;
}
.green{background-color: limegreen;}
.yellow-home{
background-color: white;
width: 30vmin;
height: 30vmin;
box-shadow: 0 0 0 1px black;
border: 5vmin solid yellow;
box-sizing: border-box;
background:
radial-gradient(circle at 25% 25%,yellow 3vmin, transparent 0),
radial-gradient(circle at 25% 75%,yellow 3vmin, transparent 0),
radial-gradient(circle at 75% 25%,yellow 3vmin, transparent 0),
radial-gradient(circle at 75% 75%,yellow 3vmin, transparent 0);
grid-column-start: 10;
grid-column-end: -1; /* can also write - span 6 */
grid-row-start: 1;
grid-row-end: 7;
}
.yellow{background-color: yellow;}
.blue-home{
background-color: white;
width: 30vmin;
height: 30vmin;
box-shadow: 0 0 0 1px black;
border: 5vmin solid blue;
box-sizing: border-box;
background:
radial-gradient(circle at 25% 25%,blue 3vmin, transparent 0),
radial-gradient(circle at 25% 75%,blue 3vmin, transparent 0),
radial-gradient(circle at 75% 25%,blue 3vmin, transparent 0),
radial-gradient(circle at 75% 75%,blue 3vmin, transparent 0);
grid-column-start: 10;
grid-column-end: -1;
grid-row-start: 10;
grid-row-end: -1;
}
.blue{background-color: blue;}
.red-home{
position: relative;
background-color: white;
width: 30vmin;
height: 30vmin;
box-shadow: 0 0 0 1px black;
border: 5vmin solid red;
box-sizing: border-box;
background:
radial-gradient(circle at 25% 25%,red 3vmin, transparent 0),
radial-gradient(circle at 25% 75%,red 3vmin, transparent 0),
radial-gradient(circle at 75% 25%,red 3vmin, transparent 0),
radial-gradient(circle at 75% 75%,red 3vmin, transparent 0);
grid-column-start: 1;
grid-column-end: 7;
grid-row-start: 10;
grid-row-end: -1;
}
.red{background-color: red;}
.home{
position: relative;
grid-column-start: 7;
grid-column-end: 10;
grid-row-start: 7;
grid-row-end: 10;
border: 1px solid black;
box-sizing: border-box;
/* Finally figured out how to make all the 4 triangles using just a single line.
Took lot of digging and reading of various types of gradients.
Thanks MDN Web Docs for immense help. Pie chart example did the trick
https://developer.mozilla.org/en-US/docs/Web/CSS/conic-gradient */
background:
conic-gradient(
from -45deg,
yellow 90deg,
blue 90deg 180deg,
red 180deg 270deg,
limegreen 270deg 360deg
);
}
.yellow-player{
grid-column: 1 / 4;
line-height: 7vmin;
vertical-align: bottom;
font-size: 1.2rem;
font-weight: bold;
transform: rotate(180deg);
transform-origin: center;
padding-left: 6vmin;
}
.blue-player{
display: flex;
grid-column: 3 / 4;
font-size: 1.2rem;
font-weight: bold;
align-items: flex-end;
}
.blue-player-name{
display: block;
transform: rotate(-90deg);
transform-origin: top left;
white-space: nowrap;
}
.red-player{
grid-column: 1 /4;
font-size: 1.2rem;
font-weight: bold;
padding-left: 5.5vmin;
}
.green-player{
grid-column: 1 / 2;
font-size: 1.2rem;
font-weight: bold;
white-space: nowrap;
transform: rotate(90deg);
transform-origin: top right;
padding-left: 5vmin;
}