Password tutorial steps
Thème :
Intermédiaire
1 vues ·3/4 leçons

Étape 3 : CSS - Le Style “Hacker”

Comme demandé, nous allons appliquer un thème Vert et Vert Sombre, similaire à la calculatrice mais avec une touche plus “console”.

Ouvrez style.css.

1. Variables et Reset

:root {
    --bg-color: #0d1117; /* Noir/Bleu nuit profond */
    --container-bg: #161b22; /* Un peu plus clair pour la carte */
    --primary: #58a6ff; /* Bleu-Vert pour les accents */
    --green-matrix: #0aff0a; /* Vert terminal pur */
    --text-color: #c9d1d9; /* Gris clair pour le texte standard */
    --border-color: #30363d;
}

/* On change un peu la palette pour être FULL VERT si préféré */
:root {
    --bg-color: #051a10;
    --container-bg: #0a2919;
    --primary: #22c55e; /* Vert standard */
    --green-matrix: #4ade80; /* Vert néon */
    --text-color: #dcfce7;
    --border-color: #14532d;
}

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

body {
    background: var(--bg-color);
    color: var(--text-color);
    font-family: 'JetBrains Mono', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

2. Le Conteneur Principal

.container {
    background: var(--container-bg);
    width: 100%;
    max-width: 450px;
    padding: 20px;
    border-radius: 8px; /* Coins un peu moins ronds, plus "tech" */
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.1);
    border: 1px solid var(--border-color);
}

.title {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--green-matrix);
}

/* Animation du curseur */
.cursor {
    animation: blink 1s infinite;
}

@keyframes blink {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

3. L’Affichage du Résultat

C’est la pièce maîtresse. On veut qu’il ressemble à un champ de saisie de code.

.result-container {
    background: #000; /* Fond noir pur */
    padding: 15px;
    border-radius: 4px; /* Coins carrés tech */
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    font-size: 1.2rem;
    height: 60px;
    color: var(--green-matrix); /* Texte vert fluo */
}

.result-container span {
    word-break: break-all; /* Si le mot de passe est géant, il passe à la ligne */
}

.btn {
    border: none;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 1rem;
    transition: 0.2s;
}

.btn:hover {
    background: #16a34a; /* Vert plus foncé */
}

/* Bouton copier spécifique (transparent) */
#clipboard {
    background: transparent;
    color: var(--primary);
}
#clipboard:hover {
    background: rgba(34, 197, 94, 0.1);
}

4. Les Réglages

.setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
}

.setting label {
    font-size: 0.9rem;
}

/* Le bouton géant */
.btn-large {
    width: 100%;
    padding: 15px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 20px;
    border: 2px solid transparent;
}

.btn-large:hover {
    background: transparent;
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.3);
}

Et voilà ! Un design vert sombre, propre et efficace.

Prêt à passer à la suite ?

Vous avez terminé cette leçon sur Étape 3 : CSS - Le Style "Hacker". Continuez votre apprentissage avec la prochaine leçon ou explorez d'autres formations.