-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
391 lines (322 loc) · 10.9 KB
/
index.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
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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>onepager.media - Interactive Information</title>
<style>
/* Basis-Styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
line-height: 1.6;
background-color: #f4f4f9;
color: #333;
display: flex;
flex-direction: column; /* Inhalt vertikal anordnen */
justify-content: center; /* Inhalt zentriert vertikal */
align-content: center; /* Inhalt zentriert horizontal */
min-height: 100vh;
text-align: center;
padding: 2rem;
margin: 0;
}
.content {
max-width: 800px;
margin: 0 auto;
text-align: center;
padding: 1rem;
}
header {
background: #88b5e8;
color: white;
text-align: center;
padding: 1rem;
margin-bottom: 1rem;
}
header h1 {
font-size: 2.5rem;
margin-bottom: 1rem;
}
h2, h3, h4, h5 {
font-size: 1rem;
margin-bottom: 0.5rem;
}
header p {
font-size: 1.2rem;
}
p {
line-height: 1.6;
margin-bottom: 1.5rem;
}
.link {
font-size: 12px;
text-align: center;
margin-top: 10px;
}
button {
padding: 10px 20px;
font-size: 1rem;
background-color: #88b5e8;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem; /* Abstand zwischen Text und Symbol */
transition: background-color 0.3s ease;
margin-bottom: 1.5rem;
}
button:hover {
background-color: #eac162;
}
body.dark-theme button {
background-color: #0984e3;
}
/* Button im Dunkelmodus */
body.dark-theme button:hover {
background-color: #eac162;
}
/* Dunkles Design (Wechsel durch Button) */
body.dark-theme {
background-color: #2d3436;
color: #dfe6e9;
}
body.dark-theme .header {
background-color: #0984e3;
}
body.dark-theme .responsive-box {
background-color: #34495e;
border-color: #2d3436;
}
body.dark-theme:hover .button {
background-color: #74b9ff;
}
.bilder-container {
display: grid;
justify-items: center;
align-items: center;
grid-template-columns: repeat(3, 1fr);
gap: 1rem; /* Abstand zwischen den Bildern */
}
/* Bild von Laptop */
.bild-groß {
width: 70%;
height: auto;
object-fit: cover;
transition: transform 0.3s ease, box-shadow 0.3s ease; /* Hover-Effekt */
}
/* Bild von Ipad */
.bild-mittel {
width: 40%;
height: auto;
object-fit: cover;
transition: transform 0.3s ease, box-shadow 0.3s ease; /* Hover-Effekt */
}
/* Bild von phone */
.bild-klein {
width: 30%;
height: auto;
object-fit: cover;
transition: transform 0.3s ease, box-shadow 0.3s ease; /* Hover-Effekt */
}
.bild:hover {
transform: scale(1.1); /*Bildschirme werden vergrößert */
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5); /* Schatten erscheint */
}
.bildschirm-container {
width: 400px;
max-width: 100%; /* Verhindert, dass das Bild größer als der Container wird */
margin: 0 auto;
}
.bildschirm-container img {
width: 100%; /* Damit das Bild die volle Container-Breite nutzt */
height: auto;
}
/* Interaktive Box */
.responsive-box {
background-color: #fff;
border: 2px solid #ddd;
padding: 1.5rem;
margin: 2rem 0;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease;
}
.responsive-box:hover {
transform: scale(1.05);
}
.screen-size-buttons {
display: flex;
justify-content: center;
gap: 10px;
margin: 20px 0;
}
.screen-size-buttons button {
padding: 10px 15px;
font-size: 1rem;
background-color: #88b5e8;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.screen-size-buttons button:hover {
background-color: #eac162;
}
/* Kleiner Bildschirm (Mobile) */
@media only screen and (max-width: 600px) {
header h1 {
font-size: 2rem;
}
header p {
font-size: 1rem;
}
.content {
width: 100%;
padding: 1rem;
}
.responsive-box {
padding: 1rem;
}
button {
width: 100%;
}
.bilder-container {
grid-template-columns: 1fr;
}
.bild-klein {
width: 20%;
}
.bild-mittel {
width: 25%;
}
.bild-groß {
width: 40%;
}
}
/* Mittlere Bildschirmgrößen (Tablets) */
@media only screen and (min-width: 601px) and (max-width: 1024px) {
header h1 {
font-size: 2.2rem;
}
.responsive-box {
padding: 1.5rem;
margin: 3rem auto;
width: 80%;
}
button {
font-size: 1.1rem;
}
}
/* Große Bildschirmgrößen (Desktops) */
@media only screen and (min-width: 1025px) {
header h1 {
font-size: 3rem;
}
header p {
font-size: 1.3rem;
}
.responsive-box {
padding: 2rem;
width: 60%;
margin: 5rem auto;
}
button {
font-size: 1.2rem;
}
}
/* Dunkles Design (Wechsel durch Button) */
@media (prefers-color-scheme: dark) {
body {
background-color: #2d3436;
color: #dfe6e9;
}
header {
background: #0984e3;
}
.responsive-box {
background-color: #34495e;
border-color: #2d3436;
}
button {
background-color: #0984e3;
}
button:hover {
background-color: #74b9ff;
}
}
</style>
</head>
<body>
<header>
<h1>Welcome to the Interactive Media Queries Page!</h1>
<p>Change the size of your screen and discover the surprises!</p>
</header>
<!-- Button zum aktivieren des Darkmode -->
<button id="darkmode-toggle">🌞 Dark Mode</button>
<section class="content">
<h2>What are media queries?</h2>
<p>Media Queries is a CSS feature that makes it possible to define different styles for different devices, screen sizes or screen resolutions. They make it possible to design a website flexibly and adaptably without having to create multiple versions of the website.</p>
<h3>Why are media queries important?</h3>
<p>With the increasing use of mobile devices, tablets and desktops with different screen sizes, it is crucial that websites look good and are user-friendly on all devices. Media queries make this possible by applying specific CSS rules only when certain conditions are met (e.g. screen width, height, orientation or resolution).</p>
<div class="bilder-container">
<img src="bilder/laptop_freigestellt.png" alt="Laptop" class="bild bild-groß">
<img src="bilder/Ipad_freigestellt.png" alt="Ipad" class="bild bild-mittel">
<img src="bilder/phone_freigestellt.png" alt="Phone" class=" bild bild-klein">
</div>
<p class="link">
<a href="https://www.seobility.net/de/wiki/Media_Queries" target="_blank">seobility.net</a>
</p>
<div class="responsive-box">
<h3>Experience how the design changes:</h3>
<p>Change the size of the window to discover the different layouts!</p>
</div>
<div class="screen-size-buttons">
<button onclick="changeScreenSize(1280, 720)">💻 Laptop</button>
<button onclick="changeScreenSize(768, 1024)">📱 Tablet</button>
<button onclick="changeScreenSize(375, 667)">📱 Mobile</button>
</div>
<h4>How do media queries work?</h4>
<p>Media queries work with conditions that are based on properties of the device or the viewport. These conditions can include the following:</p>
<p>- Width and height of the viewport (e.g. for mobile devices)</p>
<p>- Orientation (portrait or landscape format)</p>
<p>- AResolution (e.g. for Retina displays)</p>
<h5>Example of a media query for different device sizes:</h5>
<div class="bildschirm-container">
<img id="wechselbild" src="bilder/light%20mode.png" alt="light and dark mode" class="bild light-dark">
</div>
</section>
<footer>
<p>© This page was created by Anika Fiedler during the winter term 2024/25 in the Interactive Information course of the Interface Design program at the University of Applied Sciences Potsdam.</p>
</footer>
<script>
document.getElementById("darkmode-toggle").addEventListener("click", function () {
document.body.classList.toggle("dark-theme");
// Debugging: logge den aktuellen Status der Klasse "dark-theme"
console.log('Dark Mode ist jetzt aktiv:', document.body.classList.contains("dark-theme"));
// Text und Symbol im Button wechseln
if (document.body.classList.contains("dark-theme")) {
this.innerHTML = "🌙 Light Mode";
document.getElementById("wechselbild").src = "bilder/dark mode.png"; // Bild für Darkmode
} else {
this.innerHTML = "🌞 Dark Mode";
document.getElementById("wechselbild").src = "bilder/light mode.png"; // Bild für Hellenmodus
}
});
function changeScreenSize(width, height) {
window.open(
window.location.href, // Öffnet die aktuelle Seite
"_blank", // Neues Fenster
`width=${width},height=${height},resizable=yes,scrollbars=yes`
);
}
</script>
</body>
</html>