Aller au contenu principal
← 🎨 CSS as a design system·Module B9 · Leçon 6
TâcheBuild a styled <dialog>. dialog { padding: var(--space-lg); border: none; border-radius: var(--radius-lg); max-width: 400px; box-shadow: var(--shadow-lg); }. dialog::backdrop { background: oklch(0 0 0 / 0.5); backdrop-filter: blur(4px); }. dialog h2 { margin: 0 0 var(--space-md); }. dialog .close { position: absolute; top: var(--space-sm); right: var(--space-sm); background: transparent; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); }. Open the dialog via JS on load.

Capstone 6 : composant modal/dialogue

200 XP14 min
Théorie

Native <dialog> + custom styling

Recap from HTML A2 lesson 10 — <dialog> is the native modal. Here we STYLE it properly:

  • Backdrop dimming + blur.
  • Centered, with max-width.
  • Smooth open animation.
  • Close button in the top-right.
🔒

Inscris-toi pour coder

La théorie est ouverte à tous. L'éditeur, l'aperçu live et le check se débloquent avec un essai gratuit de 7 jours — carte requise, annulable à tout moment.

S'inscrire — essai gratuit →

Les 10 premières leçons de chaque parcours sont gratuites. Pas de carte requise.

← 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.