/
style.css
100 lines (96 loc) · 1.85 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
/*BASE STYLES - not needed for modal functionality*/
* {
margin: 0;
}
*+* {
margin-top: 1.5em;
}
button {
padding:0 .5em;
background-color: lightsteelblue;
border: .125em solid steelblue;
}
button:hover {
background-color: steelblue;
}
:focus {
outline: .125em solid gold;
}
body {
width: 100vw;
overflow-x: hidden;
box-sizing: border-box;
margin: 0;
}
main {
margin: 1.5em;
}
/* MODALS */
.modal::before,
.modal::after {
content: '';
width: 100%;
height: 2em;
}
.modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
z-index: 1;
display: flex;
flex-flow: row wrap;
justify-content: space-around;
overflow-y : auto;
}
/* modal background color stacking */
/*1*/
.modal:not([hidden]) {
background: rgba(0, 0, 0, 0.7);
}
/*2*/
.modal:not([hidden]) + .modal:not([hidden]):last-child {
background: rgba(0, 0, 0, 0.63);
}
/*3*/
.modal:not([hidden]) + .modal:not([hidden]) + .modal:not([hidden]):last-child {
background: rgba(0, 0, 0, 0.56);
}
/*4*/
.modal:not([hidden]) + .modal:not([hidden]) + .modal:not([hidden]) + .modal:not([hidden]):last-child {
background: rgba(0, 0, 0, 0.49);
}
/*5*/
.modal:not([hidden]) + .modal:not([hidden]) + .modal:not([hidden]) + .modal:not([hidden]) + .modal:not([hidden]):last-child {
background: rgba(0, 0, 0, 0.42);
}
.modal:not([hidden]):nth-last-of-type(n+2) {
background: rgba(0, 0, 0, 0.17);
}
.modal__content {
background: white;
width: 30vw;
margin: auto;
padding: 1.5em;
}
.modal__helper {
/*you might want to mark these as !important to ensure the correct behaviour*/
margin: 0;
border: 0;
padding: 0;
height: 0;
}
.modal__helper:focus {
outline: 0;
border: 0;
}
.noscroll {
position: fixed;
overflow: hidden;
}
[hidden] {
/* while this is the default, we have a tiny specitivity issue and need to explicitly set this */
display: none;
}