Phase 2Les fondamentaux CSS

#7 Couleurs et typographie

color, font, text, Google Fonts

Formats de couleur

CSS supporte plusieurs formats de couleur :

Valeurs de couleur
/* Couleurs nommées */
color: red;
background: cornflowerblue;

/* Hexadécimal */
color: #3b82f6;       /* 6 chiffres */
color: #3b82f680;     /* avec alpha */

/* RGB / RGBA */
color: rgb(59, 130, 246);
color: rgba(59, 130, 246, 0.5);

/* HSL — Teinte, Saturation, Luminosité */
color: hsl(217, 91%, 60%);
color: hsla(217, 91%, 60%, 0.5);

Typographie

Propriétés de police
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 400;     /* 100-900, normal=400, bold=700 */
  line-height: 1.6;     /* Multiplicateur sans unité recommandé */
  letter-spacing: 0.02em;
}

Mise en forme du texte

Propriétés de texte
h1 {
  text-align: center;
  text-transform: uppercase;
  text-decoration: underline;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

p {
  text-indent: 2em;          /* Retrait première ligne */
  white-space: nowrap;       /* Empêcher le retour à la ligne */
  overflow: hidden;
  text-overflow: ellipsis;   /* Afficher ... si tronqué */
}

Google Fonts

Utiliser Google Fonts
<!-- Dans votre <head> HTML -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">

/* Dans votre CSS */
body {
  font-family: 'Inter', sans-serif;
}

À vous de jouer

Essayez les commandes ci-dessous :

terminal — browser
user@stemlegacy:~$