Aller au contenu

Exercice 6 : Card Pokémon Responsive 🎮

🎯 Objectif

Créer une card Pokémon qui s'adapte selon la taille de l'écran en utilisant Flexbox et les Media Queries avec une approche Mobile First.

📄 Le HTML (à créer)

Créez le fichier index.html avec le contenu suivant :

<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Exercice 6 - Card Pokémon</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="card">
        <div class="card-image">
            <img src="https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/other/official-artwork/25.png" 
                 alt="Pikachu">
        </div>
        <div class="card-content">
            <h1 class="card-title">PIKACHU</h1>

            <span class="type-badge">⚡ Électrique</span>

            <p class="card-description">
                Ce Pokémon électrique est capable de projeter des décharges électriques 
                de 100 000 volts. Les forêts où vivent les Pikachu sont souvent marquées 
                par la foudre de leurs combats.
            </p>

            <h3 class="card-section-title">Statistiques</h3>
            <div class="card-stats">
                <div class="stat">
                    <div class="stat-label">PV</div>
                    <div class="stat-value">35</div>
                </div>
                <div class="stat">
                    <div class="stat-label">Attaque</div>
                    <div class="stat-value">55</div>
                </div>
                <div class="stat">
                    <div class="stat-label">Défense</div>
                    <div class="stat-value">40</div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

🎨 Le CSS (à créer)

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    max-width: 900px;
    width: 100%;
}

.card-image {
    background: linear-gradient(135deg, #ffd89b 0%, #19547b 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.card-image img {
    width: 100%;
    height: auto;
    max-width: 200px;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
}

.card-content {
    padding: 30px 20px;
    text-align: center;
}

.card-title {
    font-size: 2rem;
    color: #ffcb05;
    text-shadow: 2px 2px 0 #3d7dca;
    margin-bottom: 15px;
    font-weight: bold;
}

.type-badge {
    display: inline-block;
    background: #ffd43b;
    color: #333;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 15px;
}

.card-description {
    color: #333;
    line-height: 1.6;
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.card-section-title {
    font-size: 1.1rem;
    color: #cc0000;
    margin-bottom: 10px;
    font-weight: bold;
}

.stat {
    background: #f0f0f0;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #3d7dca;
}

📋 Comportement attendu

📱 Sur mobile (par défaut, < 768px)

  • L'image est au-dessus
  • Le contenu est en-dessous
  • Les stats sont en colonne (les unes sous les autres)

🖥️ Sur ordinateur (≥ 768px)

  • L'image est à gauche (environ 40% de largeur)
  • Le contenu est à droite (prend l'espace restant)
  • Le titre, le badge et le texte d'intro sont alignés à gauche
  • Titre plus gros
  • Padding plus important
  • Les stats sont en ligne (côte à côte)

🔧 Technologies à utiliser

  • Flexbox pour tous les layouts (card principale, stats)
  • Media Query avec approche Mobile First (min-width)
  • Images flexibles (max-width: 100%)
  • Adaptation des tailles et espacements