Quelltext ← Zurück zur Aufgabe
index.php php
<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Aufgabe 2 – Farbige Div-Container</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', system-ui, sans-serif;
            background: #0f1117;
            color: #e2e8f0;
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }

        header {
            background: #1a1f2e;
            border-bottom: 1px solid #2a3040;
            padding: 20px 32px;
            display: flex;
            align-items: center;
            gap: 16px;
        }

        header a {
            color: #3b82f6;
            text-decoration: none;
            font-size: 0.9rem;
        }

        header a:hover { text-decoration: underline; }
        header span { color: #334155; }
        header h1 { font-size: 1rem; font-weight: 600; color: #94a3b8; }

        .source-btn {
            margin-left: auto;
            padding: 6px 14px;
            background: #1e3a5f;
            border: 1px solid #2d6a9f;
            border-radius: 6px;
            color: #94c4f0;
            font-size: 0.78rem;
            text-decoration: none;
            transition: background 0.15s;
        }
        .source-btn:hover { background: #2d6a9f; color: #fff; }

        main {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 48px 24px;
            gap: 32px;
        }

        .task-title {
            text-align: center;
        }

        .task-title h2 {
            font-size: 1.6rem;
            font-weight: 700;
            color: #f1f5f9;
        }

        .task-title p {
            margin-top: 8px;
            color: #64748b;
            font-size: 0.9rem;
        }

        .grid-2x2 {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 16px;
        }

        .farb-box {
            width: 180px;
            height: 140px;
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.85rem;
            font-weight: 600;
            color: rgba(255,255,255,0.9);
            box-shadow: 0 4px 20px rgba(0,0,0,0.3);
            transition: transform 0.15s;
        }

        .farb-box:hover {
            transform: scale(1.04);
        }
    </style>
</head>
<body>

<header>
    <a href="../../">← Startseite</a>
    <span>/</span>
    <a href="../">Tag 2</a>
    <span>/</span>
    <h1>Aufgabe 2 – Farbige Div-Container</h1>
    <a class="source-btn" href="/viewer.php?path=tag2/aufgabe2">⟨/⟩ Quelltext</a>
</header>

<main>
    <div class="task-title">
        <h2>Farbige Div-Container</h2>
        <p>Vier div-Container mit PHP eingebunden im 2&times;2 Muster</p>
    </div>

    <div class="grid-2x2">
        <?php
        $farben = [
            ['bg' => '#e74c3c', 'label' => 'Rot'],
            ['bg' => '#3498db', 'label' => 'Blau'],
            ['bg' => '#2ecc71', 'label' => 'Grün'],
            ['bg' => '#f39c12', 'label' => 'Orange'],
        ];

        foreach ($farben as $farbe) {
            echo '<div class="farb-box" style="background: ' . $farbe['bg'] . ';">';
            echo htmlspecialchars($farbe['label']);
            echo '</div>' . "\n        ";
        }
        ?>
    </div>
</main>

</body>
</html>