Aufgaben-Python/courses/html_css/09_flexbox_achsen_und_alignment/aufgabe.html

230 lines
7.3 KiB
HTML

<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Übung: Flexbox Achsen &amp; Alignment</title>
<style>
:root {
--primary: #4f46e5;
--bg: #0f172a;
--surface: #1e293b;
--text: #f8fafc;
--text-muted: #94a3b8;
--border: #334155;
--accent: #06b6d4;
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: system-ui, -apple-system, sans-serif;
background-color: var(--bg);
color: var(--text);
line-height: 1.6;
padding: 24px;
}
.wrapper {
max-width: 1000px;
margin: 0 auto;
}
/* ==========================================================
* 🎯 TEILZIEL 1: Navigationsleiste als Flex-Container
- Mache .navbar zum Flex-Container
- Verteile die Hauptachse so, dass Brand links und Actions rechts sind (space-between)
- Zentriere alle Kind-Elemente vertikal auf der Querachse (center)
========================================================== */
.navbar {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 12px;
padding: 16px 24px;
margin-bottom: 32px;
/* TODO 1: Flexbox Regeln hier einfügen */
/* display: ...; */
/* justify-content: ...; */
/* align-items: ...; */
}
.nav-brand {
font-size: 1.25rem;
font-weight: 800;
color: var(--accent);
text-decoration: none;
}
/* ==========================================================
* 🎯 TEILZIEL 2: Horizontale Navigations-Links
- Mache .nav-links zum Flex-Container
- Entferne Standard-Listenpunkte (list-style: none)
- Setze einen Abstand zwischen den Links von 20px (gap)
- Zentriere vertikal (align-items: center)
========================================================== */
.nav-links {
/* TODO 2: Flexbox Regeln hier einfügen */
/* display: ...; */
/* list-style: ...; */
/* gap: ...; */
/* align-items: ...; */
}
.nav-links a {
color: var(--text-muted);
text-decoration: none;
font-size: 0.95rem;
font-weight: 500;
transition: color 0.2s;
}
.nav-links a:hover {
color: var(--text);
}
.btn {
background: var(--primary);
color: white;
border: none;
padding: 8px 18px;
border-radius: 6px;
font-weight: 600;
cursor: pointer;
}
/* ==========================================================
* 🎯 TEILZIEL 3: Card Container für responsive Karten
- Mache .card-container zum Flex-Container
- Erlaube das Umbrechen von Karten in nächste Zeilen (flex-wrap: wrap)
- Setze einen Abstand zwischen den Karten von 24px (gap)
========================================================== */
.card-container {
/* TODO 3: Flexbox Regeln hier einfügen */
/* display: ...; */
/* flex-wrap: ...; */
/* gap: ...; */
}
/* ==========================================================
* 🎯 TEILZIEL 4: Flex-Card Sizing & Spaltenlayout
- Setze für .flex-card das Flex-Wachstum: flex: 1 1 280px (oder flex-grow: 1, flex-shrink: 1, flex-basis: 280px)
- Mache .flex-card selbst zum Flex-Container mit Spaltenrichtung (flex-direction: column)
- Verteile Inhalte innen mit justify-content: space-between
- Min-Height auf 220px setzen
========================================================== */
.flex-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 12px;
padding: 24px;
/* TODO 4: Flexbox Regeln hier einfügen */
/* flex: 1 1 280px; */
/* display: flex; */
/* flex-direction: column; */
/* justify-content: space-between; */
/* min-height: 220px; */
}
/* ==========================================================
* 🎯 TEILZIEL 5: Badge-Ausrichtung mit align-self
- Richte .card__badge mit align-self: flex-start oben links aus
========================================================== */
.card__badge {
background: rgba(6, 182, 212, 0.15);
color: var(--accent);
font-size: 0.75rem;
font-weight: 700;
padding: 4px 10px;
border-radius: 9999px;
text-transform: uppercase;
letter-spacing: 0.5px;
margin-bottom: 12px;
/* TODO 5: align-self Regel hier einfügen */
/* align-self: ...; */
}
.card__title {
font-size: 1.15rem;
margin-bottom: 8px;
}
.card__desc {
color: var(--text-muted);
font-size: 0.9rem;
margin-bottom: 20px;
}
.card__footer {
border-top: 1px solid var(--border);
padding-top: 14px;
display: flex;
justify-content: space-between;
align-items: center;
}
</style>
</head>
<body>
<div class="wrapper">
<!-- Navigationsleiste -->
<header>
<nav class="navbar">
<a href="#" class="nav-brand">⚡ FlexFlow</a>
<ul class="nav-links">
<li><a href="#features">Features</a></li>
<li><a href="#pricing">Preise</a></li>
<li><a href="#docs">Dokumentation</a></li>
</ul>
<button class="btn">Kostenlos starten</button>
</nav>
</header>
<!-- Kartengitter -->
<main>
<section class="card-container">
<article class="flex-card">
<div class="card__content">
<span class="card__badge">1D-Layout</span>
<h3 class="card__title">Flex Direction &amp; Achsen</h3>
<p class="card__desc">Steuere den Fluss der Elemente flexibel entlang der horizontalen Hauptachse oder vertikalen Querachse.</p>
</div>
<div class="card__footer">
<span style="font-size: 0.8rem; color: var(--text-muted);">Lernzeit: 15 Min</span>
<button class="btn" style="padding: 4px 12px; font-size: 0.8rem;">Modul starten</button>
</div>
</article>
<article class="flex-card">
<div class="card__content">
<span class="card__badge">Alignment</span>
<h3 class="card__title">Justify &amp; Align</h3>
<p class="card__desc">Verteile Zwischenräume und zentriere Boxen pixelgenau mit modernem CSS Box Alignment.</p>
</div>
<div class="card__footer">
<span style="font-size: 0.8rem; color: var(--text-muted);">Lernzeit: 20 Min</span>
<button class="btn" style="padding: 4px 12px; font-size: 0.8rem;">Modul starten</button>
</div>
</article>
<article class="flex-card">
<div class="card__content">
<span class="card__badge">Responsivität</span>
<h3 class="card__title">Flex Wrap &amp; Sizing</h3>
<p class="card__desc">Erlaube fließendes Umbrechen und dynamisches Wachsen und Schrumpfen bei verschiedenen Bildschirmgrößen.</p>
</div>
<div class="card__footer">
<span style="font-size: 0.8rem; color: var(--text-muted);">Lernzeit: 25 Min</span>
<button class="btn" style="padding: 4px 12px; font-size: 0.8rem;">Modul starten</button>
</div>
</article>
</section>
</main>
</div>
</body>
</html>