Aller au contenu principal
Le Frontend est un bonus gratuit sur CodeMentor AI — le produit principal est Python. Inscrivez-vous pour sauvegarder votre progression et débloquer les 299 leçons Frontend + 1,100+ leçons Python.Inscription — gratuit
← 🎨 CSS as a design system·Module B1 · Leçon 10
TâcheBuild a card system. Reset: *, *::before, *::after { box-sizing: border-box; } body { margin: 0; font-family: system-ui, sans-serif; color: #111; }. Tokens on :root: --primary #3B82F6, --bg-card white, --radius 12px, --pad 20px. .card: padding var(--pad), border 1px solid #e5e7eb, border-radius var(--radius), background var(--bg-card), margin 12px. .card.featured: border-color var(--primary), border-width 2px. .badge: display inline-block, padding 2px 8px, background var(--primary), color white, border-radius 999px, font-size 11px, margin-left 8px.

Module de synthèse : cascade + boîtier + variables dans une seule carte

200 XP14 minFREE
Théorie

Putting B1 together

Build a complete card component that uses EVERY concept from B1:

  • Global reset (box-sizing: border-box) — lesson 6.
  • Custom properties for tokens — lesson 9.
  • Inherited typography from body — lesson 3.
  • Specific .card.featured override that wins by specificity — lesson 2.
  • Padding + border + margin — lesson 5.
  • Inline-block badge inside the title — lesson 8.
  • No reliance on !important — lesson 4.

This card is the kind of component every site ships dozens of. Building it correctly from B1 alone sets the muscle memory for the rest of the CSS track.

2 onglets
Aperçu en direct
← PrécédentLeçon suivante →

Recevez une astuce Python ou web par jour — par email

Court, écrit à la main, sans spam. Désabonnement en un clic.