HTML: details

The <details> element creates a native disclosure widget for supplementary information, and <summary> provides its visible heading.

What you will learn

Minimal example

<details>
  <summary>Show delivery details</summary>
  <p>Orders usually arrive within three business days.</p>
</details>

The user can activate the summary to open or close the content. Keyboard users can operate the native control as well.

Open by default

<details open>
  <summary>Important information</summary>
  <p>This content is visible when the page loads.</p>
</details>

Common mistakes