{ "$schema": "../../schemas/code-crispies-module-schema.json", "id": "html-forms-fieldset", "title": "Formulare mit Fieldsets", "description": "Gruppiere Formularelemente mit fieldset und legend", "mode": "html", "difficulty": "beginner", "lessons": [ { "id": "fieldset-basic", "title": "Gruppieren mit Fieldset", "description": "Das <fieldset>-Element gruppiert zusammengehörige Formularfelder. Füge ein <legend> als erstes Kind hinzu, um der Gruppe einen Titel zu geben.

Das verbessert die Zugänglichkeit und visuelle Organisation komplexer Formulare.", "task": "Erstelle ein Formular mit einem Fieldset:
1. Ein <form>-Element
2. Ein <fieldset> darin
3. Ein <legend> mit 'Persönliche Daten'
4. Zwei beschriftete Eingabefelder für Name und E-Mail", "previewHTML": "", "previewBaseCSS": "body { font-family: system-ui; padding: 20px; background: #f0f4f8; } form { max-width: 400px; } fieldset { border: 2px solid #3498db; border-radius: 10px; padding: 20px; background: white; } legend { color: #3498db; font-weight: 600; padding: 0 10px; font-size: 1.1rem; } label { display: block; margin: 15px 0 5px; color: #333; font-weight: 500; } input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 16px; box-sizing: border-box; } input:focus { outline: 2px solid #3498db; border-color: transparent; }", "sandboxCSS": "", "initialCode": "", "solution": "
\n
\n Persönliche Daten\n \n \n \n \n
\n
", "previewContainer": "preview-area", "validations": [ { "type": "element_exists", "value": "form", "message": "Füge ein
-Element hinzu" }, { "type": "element_exists", "value": "fieldset", "message": "Füge ein
im Formular hinzu" }, { "type": "element_exists", "value": "legend", "message": "Füge ein für den Titel hinzu" }, { "type": "element_count", "value": { "selector": "label", "min": 2 }, "message": "Füge mindestens 2 Labels hinzu" }, { "type": "element_count", "value": { "selector": "input", "min": 2 }, "message": "Füge mindestens 2 Eingabefelder hinzu" } ] }, { "id": "fieldset-textarea", "title": "Textarea hinzufügen", "description": "Das <textarea>-Element erstellt ein mehrzeiliges Textfeld, perfekt für längere Inhalte wie Nachrichten oder Beschreibungen.

Verwende rows und cols Attribute, um die Standardgröße festzulegen.", "task": "Erstelle ein Kontaktformular:
1. Ein <fieldset> mit <legend> 'Kontaktiere uns'
2. Ein beschriftetes <input> für E-Mail
3. Eine beschriftete <textarea> für die Nachricht
4. Einen Absende-<button>", "previewHTML": "", "previewBaseCSS": "body { font-family: system-ui; padding: 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; margin: 0; box-sizing: border-box; } form { max-width: 450px; margin: 0 auto; } fieldset { border: none; border-radius: 15px; padding: 30px; background: white; box-shadow: 0 10px 40px rgba(0,0,0,0.2); } legend { color: #667eea; font-weight: 700; padding: 0; font-size: 1.5rem; margin-bottom: 10px; } label { display: block; margin: 20px 0 8px; color: #333; font-weight: 500; } input, textarea { width: 100%; padding: 12px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 16px; box-sizing: border-box; font-family: inherit; } input:focus, textarea:focus { outline: none; border-color: #667eea; } textarea { resize: vertical; min-height: 100px; } button { margin-top: 20px; width: 100%; padding: 14px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; } button:hover { opacity: 0.9; }", "sandboxCSS": "", "initialCode": "", "solution": "\n
\n Kontaktiere uns\n \n \n \n \n \n
\n", "previewContainer": "preview-area", "validations": [ { "type": "element_exists", "value": "fieldset", "message": "Füge ein
-Element hinzu" }, { "type": "element_exists", "value": "legend", "message": "Füge ein -Element hinzu" }, { "type": "element_exists", "value": "textarea", "message": "Füge eine \n
\n \n", "previewContainer": "preview-area", "validations": [ { "type": "element_count", "value": { "selector": "fieldset", "min": 2 }, "message": "Erstelle mindestens 2 Fieldsets" }, { "type": "element_count", "value": { "selector": "legend", "min": 2 }, "message": "Füge zu jedem Fieldset ein Legend hinzu" }, { "type": "element_exists", "value": "textarea", "message": "Füge eine Textarea für die Bio hinzu" }, { "type": "element_exists", "value": "button", "message": "Füge einen Absende-Button hinzu" }, { "type": "element_count", "value": { "selector": "input", "min": 2 }, "message": "Füge mindestens 2 Eingabefelder hinzu" } ] } ] }