"
}
]
},
{
"id": "faq-accordion",
"title": "FAQ Accordion",
"description": "Multiple <details> elements create an accordion-style FAQ. Each question can be expanded independently.
This is a common pattern for FAQ pages, documentation, and help sections.",
"task": "Create an FAQ section with:
1. An <h1> saying 'Frequently Asked Questions'
2. Three <details> elements, each with a question in <summary> and an answer in <p>",
"previewHTML": "",
"previewBaseCSS": "body { font-family: system-ui; min-height: 100vh; background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); display: flex; flex-direction: column; justify-content: center; padding: 40px; margin: 0; box-sizing: border-box; } h1 { font-size: 2.5rem; color: #4a4a4a; text-align: center; margin: 0 0 30px 0; } details { background: white; border-radius: 12px; margin-bottom: 15px; padding: 20px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); } summary { font-size: 1.3rem; font-weight: 600; color: #5c5c5c; cursor: pointer; list-style: none; } summary::before { content: '▸ '; color: #fcb69f; } details[open] summary::before { content: '▾ '; } details p { margin: 15px 0 0 0; color: #666; line-height: 1.6; }",
"sandboxCSS": "",
"initialCode": "",
"solution": "Frequently Asked Questions
\n\n\n What is HTML5?
\n HTML5 is the latest version of HTML with new semantic elements and APIs.
\n \n\n\n Do I need JavaScript?
\n Many interactive features work with pure HTML5, no JavaScript required!
\n \n\n\n Is this accessible?
\n Yes! Native HTML elements have built-in keyboard and screen reader support.
\n ",
"previewContainer": "preview-area",
"validations": [
{
"type": "element_exists",
"value": "h1",
"message": "Add an <h1> heading for the FAQ title"
},
{
"type": "element_count",
"value": { "selector": "details", "min": 3 },
"message": "Create at least 3 elements for the FAQ"
},
{
"type": "element_count",
"value": { "selector": "summary", "min": 3 },
"message": "Each <details> needs a for the question"
},
{
"type": "element_count",
"value": { "selector": "details p", "min": 3 },
"message": "Each <details> needs a for the answer"
}
]
}
]
}