details and summary Disclosure Widget
Build native expand/collapse components without JavaScript.
What Are details and summary?
The <details> and <summary> elements create a native disclosure widget — an expand/collapse component — without any JavaScript:
<details>
<summary>What is HTML?</summary>
<p>HTML (HyperText Markup Language) is the standard markup language
used to create web pages.</p>
</details>How It Works
Interaction behavior:
- By default, only the
<summary>is visible - Clicking the summary toggles the visibility of the remaining content
- A disclosure triangle appears on the summary by default
- No JavaScript required
All lessons in this course
- aside Complementary Content
- figure and figcaption Revisited
- details and summary Disclosure Widget
- The progress and meter Elements