forked from EmuDeck/EmuDeckWebsite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
modal.html
105 lines (100 loc) · 2.02 KB
/
modal.html
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
<style>
body {
margin: 0;
padding: 0;
font-family: sans-serif;
}
h2 {
font-size: 1.1em;
margin-top: 2em;
text-align: center;
}
main {
width: 80%;
margin: auto;
}
#modal {
background: rgba(0, 0, 0, 0.9);
color: #fff;
position: fixed;
top: -100vh;
left: 0;
height: 100vh;
width: 100vw;
transition: all 0.5s;
}
#modal p {
width: 60%;
height: 40%;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
margin: auto;
font-size: 1.5em;
text-align: center;
}
#mostrar-modal {
display: none;
}
#mostrar-modal + label {
background: steelblue;
display: table;
margin: auto;
color: #fff;
line-height: 3;
padding: 0 1em;
text-transform: uppercase;
cursor: pointer;
}
#mostrar-modal + label:hover {
background: #38678f;
}
#mostrar-modal:checked ~ #modal {
top: 0;
}
#mostrar-modal:checked ~ #cerrar-modal + label {
display: block;
}
#cerrar-modal {
display: none;
}
#cerrar-modal + label {
position: absolute;
top: 1em;
right: 1em;
z-index: 100;
color: #fff;
font-weight: bold;
cursor: pointer;
background: tomato;
width: 25px;
height: 25px;
line-height: 25px;
text-align: center;
border-radius: 50%;
display: none;
transition: all 0.5s;
}
#cerrar-modal:checked ~ #modal {
top: -100vh;
}
#cerrar-modal:checked + label {
display: none;
}
</style>
<main>
<h2>Modal with :checked and radio buttons by Escuela Digital</h2>
<input type="radio" id="mostrar-modal" name="modal" />
<label for="mostrar-modal">Ver modal</label>
<input type="radio" id="cerrar-modal" name="modal" />
<label for="cerrar-modal">X</label>
<div id="modal">
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nostrum nihil id
commodi ipsa vitae dolore molestiae minus enim. Nulla ut recusandae nemo
quam autem minus totam impedit, quod accusamus optio?
</p>
</div>
</main>