{
"$schema": "../../schemas/code-crispies-module-schema.json",
"id": "html-dialog",
"title": "Natives Dialog-Element",
"description": "Erstelle modale Dialoge ohne JavaScript-Bibliotheken",
"mode": "html",
"difficulty": "beginner",
"lessons": [
{
"id": "dialog-basic",
"title": "Dialog öffnen",
"description": "Das <dialog>-Element erstellt ein natives Modal. Füge das open-Attribut hinzu, um es anzuzeigen.
Verwende <form method=\"dialog\"> darin, um es beim Absenden des Formulars zu schließen - kein JavaScript nötig!",
"task": "Erstelle einen Dialog mit:
1. Dem open-Attribut, um ihn anzuzeigen
2. Einem <h2> mit 'Willkommen!'
3. Einem <p> mit einer Begrüßungsnachricht
4. Einem <form method=\"dialog\"> mit einem Schließen-Button",
"previewHTML": "",
"previewBaseCSS": "body { font-family: system-ui; padding: 20px; min-height: 200px; background: #f5f5f5; } dialog { border: none; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); padding: 25px; max-width: 400px; } dialog::backdrop { background: rgba(0,0,0,0.5); } dialog h2 { margin: 0 0 15px 0; color: #1976d2; } dialog p { color: #666; margin: 0 0 20px 0; } dialog button { background: #1976d2; color: white; border: none; padding: 10px 25px; border-radius: 6px; cursor: pointer; font-size: 16px; } dialog button:hover { background: #1565c0; }",
"sandboxCSS": "",
"initialCode": "",
"solution": "",
"previewContainer": "preview-area",
"validations": [
{
"type": "element_exists",
"value": "dialog",
"message": "Füge ein <dialog>-Element hinzu"
},
{
"type": "attribute_value",
"value": { "selector": "dialog", "attr": "open", "value": true },
"message": "Füge das open-Attribut hinzu, um den Dialog anzuzeigen"
},
{
"type": "element_exists",
"value": "dialog h2",
"message": "Füge eine <h2>-Überschrift im Dialog hinzu"
},
{
"type": "element_exists",
"value": "form[method='dialog']",
"message": "Füge ein