-
Notifications
You must be signed in to change notification settings - Fork 0
/
style.css
322 lines (320 loc) · 10.8 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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
:root{
/* colors */
--strong-cyan: hsl(172, 67%, 45%);
--very-dark-cyan: hsl(183, 100%, 15%);
--empty-cyan: hsla(183, 78%, 24%, 1);
--dark-grayish-cyan1: hsl(186, 14%, 43%);
--dark-grayish-cyan2: hsl(184, 14%, 56%);
--light-grayish-cyan1: hsl(185, 41%, 84%);
--light-grayish-cyan2: hsl(189, 41%, 97%);
--light-cyan: hsla(173, 61%, 77%, 1);
--red: hsla(13, 70%, 61%, 1);
}
html {
font-size: 10px;
}
*, *::after, *::before {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background: var(--light-grayish-cyan1);
font-family: 'Space Mono', monospace;
font-size: 2.4rem;
display: flex;
flex-wrap: wrap;
flex-direction: column;
align-items: center;
justify-content: space-around;
align-content: space-evenly;
min-height: 100vh;
}
/* - Mobile: 375px
- Desktop: 1440px */
/* mobile first, from outter to inner boxes */
h1 {
font-size: 1px;
color: transparent;
}
#logo {
align-self: center;
width: 8.67rem;
height: auto;
margin-top: 3rem;
}
form {
max-width: 37.5rem;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-evenly;
margin-top: 3rem;
border-radius: 1rem;
background: hsl(0, 0%, 100%);
padding: 3.2rem 2.4rem;
font-weight: 700;
}
/* inside form */
/* inside .bill-cont, fieldset, .people-cont */
input {
cursor: pointer;
border: 2px solid transparent;
}
/* inside #input */
.bill-cont, fieldset, .people-cont, #output {
display: flex;
flex-direction: column;
justify-content: center;
width: 31.1rem;
margin-top: 3.2rem;
}
.bill-cont, .people-cont, legend {
height: 7.8rem;
font-size: 1.6rem;
color: var(--dark-grayish-cyan1);
}
fieldset {
border: none;
}
/* inside .people-cont + .bill-cont */
.bill-input-cont, .people-input-cont {
position: relative;
height: 4.8rem;
background: var(--light-grayish-cyan2);
}
.bill-input-cont > input, .people-input-cont > input {
position: absolute;
left: 0;
top:0;
width: 100%;
height: 100%;
background: transparent;
border: none;
text-align: right;
font-family: 'Space Mono', monospace;
color: var(--very-dark-cyan);
font-size: 2.4rem;
font-weight: 700;
}
.bill-input-cont > img, .people-input-cont > img {
position: absolute;
top: 1.6rem;
left: 1.6rem;
}
/* warning when zero people. I would simply prevent that by min=1-attribut in the html but
... */
.red-when-zero-people {
display: inline;
position: absolute;
right: 0;
text-align: right;
color: var(--red);
}
.no-warning {
display: none;
}
input.red-border {
border: 2px solid var(--red);
}
/* inside fieldset */
legend {
/* more style rules above
together with .bill-cont, .people-cont */
height: 2.4rem;
}
#btn-container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
}
/* inside btn-container */
.btn-cont {
display: block;
position: relative;
width: 14.66rem;
height: 4.8rem;
margin-top: 1.6rem;
border-radius: 0.5rem;
}
.tip-label {
display: block;
position: relative;
width: 14.66rem;
height: 4.8rem;
background: var(--very-dark-cyan);
text-align: center;
font-size: 2.4rem;
line-height: 2;
color: hsl(0, 0%, 100%);
border-radius: 0.5rem;
}
input[type=radio]:checked ~ label {
background: var(--strong-cyan);
color: var(--very-dark-cyan);
box-shadow: 0 0 0 4px var(--light-cyan);
}
/* makes default radio btns invisible */
.tipPercent {
position: absolute;
left: 0;
top:0;
opacity: 0;
width: 14.66rem;
height: 4.8rem;
/* put radios above labels to be clickable, but in the html they have to be before
the radios to make the ~-sibling-selector work to style the checked state of the invisible radios
showing in the labels*/
z-index: 1;
}
.btn-cont:hover label{
background: var(--light-cyan);
color: var(--very-dark-cyan);
}
/* customBtn -container to stack radio and input */
.customBtn label {
background: var(--light-grayish-cyan2);
color: transparent;
border: 2px solid transparent;
}
.customBtn:hover label, .bill-input-cont:hover, .people-input-cont:hover {
outline: 2px solid var(--strong-cyan);
background: var(--light-grayish-cyan2);
}
.customBtn:hover label {
color: transparent;
}
*:focus{
box-shadow: 0px 0px 8px var(--strong-cyan);
}
.customBtn label:last-of-type {
opacity: 0;
}
#customInput {
opacity: 1;
background: transparent;
border: 2px solid transparent;
text-align: center;
font-family: 'Space Mono', monospace;
color: var(--very-dark-cyan);
font-size: 2.4rem;
font-weight: 700;
}
/* appearance must not be used for websites (MDNdocs!), but it works on my machine ¯\_(ツ)_/¯, Kevin! */
/* Seriously: if you know how and IF the spinner arrows can/should be hidden, pls let me know */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
-webkit-appearance: none;
}
input[type="number"] {
outline: transparent;
padding-right: 1rem;
}
.people-cont {
position: relative;
}
/* last rule with high specificity to overwrite ... */
#custom:checked + #custom-label {
color: transparent;
background: var(--light-grayish-cyan2);
}
#btn-container input[type="radio"]:focus + label {
box-shadow: 0 0 0 4px var(--light-cyan);
}
#output {
background: var(--very-dark-cyan);
padding: 3.6rem 2.4rem 2.4rem 2.4rem;
border-radius: 1rem;
}
/* inside output */
.output-numbers {
justify-content: space-between;
}
/* choose all p elem with an id ending with "person" by attribute selector */
p[id$="person"]{
font-size: 1.6rem;
color: hsl(0, 0%, 100%);
}
p[id$="person"] span{
font-size: 1.3rem;
color: var(--dark-grayish-cyan2);
}
.totalOutput {
margin-top: 2rem;
}
/* choose all p elem with an id ending with "Sum" by attribute selector */
p[id$="Sum"]{
align-self: flex-end;
font-size: 3.2rem;
}
#reset {
width: 100%;
height: 4.8rem;
border-radius: 0.5rem;
margin-top: 3.2rem;
background: var(--strong-cyan);
font-family: 'Space Mono', monospace;
color: hsl(183, 100%, 15%);
font-size: 2rem;
font-weight: 700;
}
#reset:hover {
background: var(--light-cyan);
color: var(--very-dark-cyan);
}
/* hide label for reset btn visually */
.hide-visually {
position: absolute;
color: transparent;
}
.output-numbers {
display: flex;
color: var(--strong-cyan);
}
/* high specificity neccessary */
input#reset.empty {
background: var(--empty-cyan);
color: var(--very-dark-cyan);
}
.attribution {
font-size: 1.7rem;
}
/* media-queries for desktop version */
@media (min-width: 925px) {
form {
width: 100%;
max-width: 92rem;
height: 48.1rem;
padding: 3.2rem 3.2rem 3.2rem 4.8rem;
justify-content: space-between;
}
.bill-cont, fieldset, .people-cont, #output {
width: 37.9rem;
}
#input {
width: 37.9rem;
height: 38.8rem;
margin-right: 3.2rem;
}
.bill-cont {
margin-top: 0;
}
.btn-cont, .tip-label, .tipPercent {
width: 11.7rem;
}
#output {
width: 41.3rem;
height: 41.7rem;
margin-top: 0;
border-radius: 1.5rem;
padding: 4rem;
justify-content: space-between;
}
.totalOutput {
margin-top: 0;
}
#reset {
margin-top: 12.2rem;
}
}