details
The disclosure container.
Learn Details & Summary with practical examples for rich HTML features, native browser behavior, accessibility, performance, SEO and live practice.
HTML advanced
The details element creates expandable content. The summary element is the visible control the user activates.
This is useful for FAQs, optional explanations, compact settings and progressive disclosure.
Because the browser provides the open and close behavior, details is often more robust than a hand-built accordion for simple use cases.
The disclosure container.
The visible clickable label.
Attribute that starts the disclosure expanded.
Showing optional detail only when wanted.
Syntax and behavior
Do not use vague labels like More. Tell users what kind of information they will reveal.
<details> <summary>What does the HTML course include?</summary> <p>It includes structure, forms, media, accessibility and production HTML.</p> </details>
<details> <summary>Click</summary> <p>Some hidden information.</p> </details>
Rules that matter
These elements can create rich interfaces, but they still need clear purpose, safe fallbacks and production discipline.
The summary is the control label.
Do not hide critical information users must read.
Massive disclosures become hard to scan.
Start expanded when the information is important.
Do not remove focus or make the summary look non-interactive.
Native disclosure is enough for many cases.
Production thinking
This matters because native HTML often gives you a cleaner solution than rebuilding interaction with JavaScript.
Details and summary provide native disclosure semantics and keyboard behavior in modern browsers.
Good for FAQs and optional help text. For complex accordions, test browser behavior and state management carefully.
Content inside details is still present in HTML, but critical sales or learning content should not be buried unnecessarily.
Live code lab
Edit the HTML or CSS, then use Run to refresh the preview. The preview is isolated, so links and forms stay inside this practice area.
Mini assignment
Practice assignment
Try it yourself
Self-check
Do not only read this page. Answer these questions out loud or write the answers in your own notes. If one answer feels vague, revisit the examples before moving on.