<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Mes Projets</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <header>
        <h1>Bienvenue sur ma page de projets</h1>
    </header>
    <main>
        <section id="projets">
            <h2>Mes différents projets</h2>
            <ul>
                <?php
                $projets = ['epicerie', 'vanerie', 'sncf'];
                $dossierImages = 'images/'; // Chemin vers votre dossier d'images

                foreach ($projets as $projet) {
                    $nomProjetFormate = ucfirst($projet); // Met la première lettre en majuscule
                    $cheminImage = $dossierImages . $projet . '.png'; // Exemple de nommage d'image
                    // Vérifie si l'image existe, sinon utilise une image par défaut
                    if (!file_exists($cheminImage)) {
                        $cheminImage = $dossierImages . 'default.png'; // Créez une image default.png
                    }

                    echo '<li>';
                    echo '<img src="' . $cheminImage . '" alt="' . $nomProjetFormate . '" width="100">';
                    echo '<a href="' . $projet . '/">' . $nomProjetFormate . '</a>';
                    echo '</li>';
                }
                ?>
            </ul>
        </section>
    </main>

    <footer>
        <p>&copy; <?php echo date("Y"); ?> - Mes Projets</p>
    </footer>
</body>
</html>
 
body {
    font-family: sans-serif;
    margin: 20px;
    background-color: #f4f4f4;
    color: #333;
}

header {
    background-color: #333;
    color: white;
    padding: 1em;
    text-align: center;
    margin-bottom: 20px;
}

main {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

#projets h2 {
    color: #333;
    border-bottom: 2px solid #ccc;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

#projets ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

#projets li {
    background-color: #eee;
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    width: calc(33% - 20px); /* Pour 3 projets par ligne avec un peu d'espace */
    box-sizing: border-box;
}

#projets img {
    max-width: 80px;
    height: auto;
    margin-bottom: 10px;
}

#projets a {
    text-decoration: none;
    color: #007bff;
    font-weight: bold;
}

#projets a:hover {
    text-decoration: underline;
}

footer {
    text-align: center;
    margin-top: 20px;
    color: #777;
}
