-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathindex.html
More file actions
265 lines (265 loc) · 7.19 KB
/
index.html
File metadata and controls
265 lines (265 loc) · 7.19 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Hover Magic</title>
<style>
:root {
--bg: #f8fafc;
--txt: #1e293b;
--card: #ffffff;
--sh: rgba(0,0,0,0.08);
--accent: #6366f1;
--tog-bg: #cbd5e1;
--handle: #ffffff;
}
[data-theme="dark"] {
--bg: #0f172a;
--txt: #f1f5f9;
--card: #1e293b;
--sh: rgba(0,0,0,0.3);
--accent: #a78bfa;
--tog-bg: #475569;
--handle: #f1f5f9;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: var(--bg);
color: var(--txt);
font-family: 'Segoe UI', system-ui, sans-serif;
line-height: 1.6;
transition: all 0.4s ease;
padding: 2rem 1rem;
}
h1 {
text-align: center;
margin-bottom: 2rem;
font-size: 2.5rem;
font-weight: 700;
background: linear-gradient(135deg, var(--accent), #8b5cf6);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.header {
display:flex;
justify-content:space-between;
align-items:center;
flex-wrap:wrap;
gap:1rem;
margin-bottom:2rem;
padding: 0 4rem;
}
.toggle-container {
display: flex;
justify-content: center;
align-items: center;
gap: 1rem;
margin-bottom: 3rem;
flex-wrap: wrap;
}
.toggle-wrapper {
display: flex;
align-items: center;
gap: 0.75rem;
font-weight: 500;
font-size: 1rem;
}
.toggle-label {
position: relative;
width: 60px;
height: 32px;
}
.toggle-label input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: var(--tog-bg);
transition: 0.4s;
border-radius: 32px;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 3px;
bottom: 3px;
background: var(--handle);
transition: 0.4s;
border-radius: 50%;
box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
input:checked + .slider {
background: var(--accent);
}
input:checked + .slider:before {
transform: translateX(28px);
}
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
gap: 2rem;
max-width: 1200px;
margin: 0 auto;
}
.card {
background: var(--card);
padding: 5rem 5rem;
border-radius: 20px;
box-shadow: 0 10px 30px var(--sh);
text-align: center;
cursor: pointer;
position: relative;
overflow: hidden;
min-height: 120px;
display: flex;
align-items: center;
justify-content: center;
font-family: 'Courier New', monospace;
font-size: 2rem;
font-weight: bold;
transition: all 0.3s ease;
border: 1px solid rgba(255,255,255,0.2);
}
.card:hover {
transform: translateY(-8px);
box-shadow: 0 20px 40px var(--sh);
border-color: var(--accent);
}
/* Hide text until hover */
.card > div {
opacity: 0;
transition: opacity 0.3s ease;
}
.card:hover > div {
opacity: 1;
}
/* Typewriter */
.typewriter {
width: 0;
white-space: nowrap;
overflow: hidden;
border-right: 3px solid transparent;
}
.card:hover .typewriter {
width: 11ch;
border-color: var(--txt);
animation: typing 2.5s steps(11) forwards, blink 0.75s infinite;
}
@keyframes typing { from { width: 0; } to { width: 11ch; } }
@keyframes blink { 50% { border-color: transparent; } }
/* Rotate Letters */
.rotate span { display: inline-block; opacity: 0; }
.card:hover .rotate span {
opacity: 1;
animation: rotateLetter 0.8s ease-out forwards;
}
.rotate span:nth-child(n) { animation-delay: calc(0.05s * var(--n)); }
@keyframes rotateLetter {
0% { transform: rotateY(0deg); opacity: 0; }
50% { transform: rotateY(180deg); }
100% { transform: rotateY(360deg); opacity: 1; }
}
/* Bounce */
.bounce span {
display: inline-block;
opacity: 0;
transform: translateY(30px);
}
.card:hover .bounce span {
opacity: 1;
animation: bounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}
.bounce span:nth-child(1) { animation-delay: 0.1s; }
.bounce span:nth-child(2) { animation-delay: 0.15s; }
.bounce span:nth-child(3) { animation-delay: 0.2s; }
.bounce span:nth-child(4) { animation-delay: 0.25s; }
.bounce span:nth-child(5) { animation-delay: 0.3s; }
.bounce span:nth-child(6) { animation-delay: 0.35s; }
@keyframes bounce {
0% { transform: translateY(30px); }
60% { transform: translateY(-10px); }
100% { transform: translateY(0); }
}
/* Slide In */
.slide { opacity: 0; transform: translateX(-50px); }
.card:hover .slide {
opacity: 1;
transform: translateX(0);
transition: all 0.6s ease-out;
}
/* Rainbow */
.rainbow { opacity: 0; }
.card:hover .rainbow {
opacity: 1;
background: linear-gradient(45deg, #ff0000, #ff8000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
background-size: 400% 400%;
-webkit-background-clip: text;
background-clip: text;
color: transparent;
animation: rainbow 3s linear infinite;
}
@keyframes rainbow {
0% { background-position: 0% 50%; }
100% { background-position: 400% 50%; }
}
/* Pulse */
.pulse { opacity: 0; }
.card:hover .pulse {
opacity: 1;
animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.1); }
}
@media (max-width: 768px) {
.grid {
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 1.5rem;
}
h1 { font-size: 2rem; }
body { padding: 1rem; }
}
</style>
</head>
<body>
<div class="header">
<h1> Hover to see the magic </h1>
<div class="toggle-container">
<label class="toggle-wrapper">
<div class="toggle-label">
<input type="checkbox" id="themeToggle" onchange="document.documentElement.setAttribute('data-theme', this.checked ? 'dark' : 'light')">
<span class="slider"></span>
</div>
</label>
</div>
</div>
<div class="grid">
<div class="card"><div class="typewriter">Typewriter</div></div>
<div class="card"><div class="rotate">
<span style="--n:1">R</span><span style="--n:2">o</span><span style="--n:3">t</span><span style="--n:4">a</span><span style="--n:5">t</span><span style="--n:6">e</span>
</div></div>
<div class="card"><div class="bounce">
<span>B</span><span>o</span><span>u</span><span>n</span><span>c</span><span>e</span>
</div></div>
<div class="card"><div class="slide">Slide In</div></div>
<div class="card"><div class="rainbow">Rainbow</div></div>
<div class="card"><div class="pulse">Pulse</div></div>
</div>
</body>
</html>