-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHTML_CSS_POPUP.html
executable file
·200 lines (164 loc) · 3.92 KB
/
HTML_CSS_POPUP.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
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
<!doctype html>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<html>
<head>
<!--
! Design and Development by Cyrille Besson
! update : 2021.07.07
* Responsive
* colors in variables
* auto-closing function
* hover CTA
? illustration
? web font
TODO automated dark mode function
-->
<!--
* comment
! important comment
? question
TODO list
// old comment
-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<style type="text/css">
* {
margin: 0;
padding: 0;
}
:root {
--color-text: #04151F;
--color-cta: #4091f7;
--color-hover: #0073ff;
--color-shade: #dcecff;
}
#CB_modal {
background: #ffffff80;
position: fixed;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
z-index: 2147483646;
display: flex;
flex-wrap: nowrap;
justify-content: center;
align-items: center;
font-size: 16px;
font-family: Arial, sans-serif;
line-height: normal;
text-align: left;
font-weight: normal;
color: var(--color-text);
}
#CB_popup {
max-width: 500px;
margin: 10px;
min-height: auto;
position: relative;
z-index: 2147483647;
background-color: #fff;
border-radius: 0.4em;
box-shadow: 0px 0px 80px var(--color-shade);
padding: calc(8px + 4%);
}
/* Closing Button style and functions */
.CB_X {
position: absolute;
top: 0.2em;
right: 0.2em;
border: 0;
color: #fff;
background: #ccc;
border-radius: 100%;
height: 1.2em;
width: 1.2em;
line-height: 1.3em;
font-size: 1.2em;
}
/* Link style and functions */
#CB_popup a {
color: var(--color-text);
cursor: pointer;
text-decoration: none;
}
/* Title style and functions */
#CB_popup h1 {
font-size: 1.8em;
font-weight: bold;
margin-bottom: 0.5em;
}
/* Copy style and functions */
#CB_popup h3 {
font-size: 1.2em;
font-weight: normal;
}
/* Disclaimer style and functions */
#CB_popup p {
font-size: 0.8em;
}
/* CTA style and functions */
#CB_CTA {
border: 0;
border-radius: 2em;
background: var(--color-cta);
color: #fff;
font-size: 1.2em;
white-space: nowrap;
text-decoration: none;
padding: 0.5em 1.5em;
margin: 1em 0;
cursor: pointer;
cursor: pointer;
display: inline-block;
position: relative;
transition: all 0.2s;
}
#CB_CTA:hover {
background: var(--color-hover);
box-shadow: 0px 0px 10px var(--color-cta);
}
#CB_CTA:focus {
outline: none;
}
#CB_CTA:active {
background: var(--color-cta);
}
/* Responsive rules */
@media only screen and (max-width: 480px) {
#CB_popup h3 br,
#CB_popup p br {
display: none;
}
}
</style>
<title>HTML/CSS open-source popup</title>
</head>
<body>
<div id="CB_modal">
<div id="CB_popup">
<button class="CB_X" href="javascript:void(0);"
onclick="document.getElementById('CB_modal').style.display='none';">
×
</button>
<!-- ! Link with closing function -->
<a href="https://github.com/cyrillebesson/HTML_CSS_popup" target="_blank"
onclick="document.getElementById('CB_modal').style.display='none';">
<h1>
Title
</h1>
<h3>
Here is a fully responsive <b>open-source popup</b> made of HTML and CSS with auto-closing function
</h3>
<button autofocus id="CB_CTA">
Call To Action
</button>
</a>
<p>
Feel free to improve and share it.
</p>
</div>
</div>
</body>
</html>