Phase 2Les fondamentaux CSS

#8 Fonds et bordures

background, dégradés, border-radius, ombres

Arrière-plans

Propriétés de fond
.hero {
  background-color: #1a1a2e;
  background-image: url("hero-bg.jpg");
  background-size: cover;       /* Remplir le conteneur */
  background-position: center;
  background-repeat: no-repeat;
}

Dégradés

Dégradés CSS
/* Dégradé linéaire */
.degrade-1 {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
}

/* Dégradé radial */
.degrade-2 {
  background: radial-gradient(circle at top left, #3b82f6, transparent);
}

/* Fonds multiples */
.superpose {
  background:
    linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)),
    url("photo.jpg") center / cover no-repeat;
}

Bordures

Propriétés de bordure
.card {
  border: 1px solid #e0dbd4;
  border-radius: 12px;
}

/* Côtés individuels */
.separateur {
  border-top: 2px solid #3b82f6;
  border-bottom: none;
}

/* Outline (n'affecte pas le layout) */
.focus-ring {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

Ombres

Ombres de boîte et de texte
.card {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
              0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.card:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
}

h1 {
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

À vous de jouer

Essayez les commandes ci-dessous :

terminal — browser
user@stemlegacy:~$