<details>...</details>

HTML4 HTML5

Creates an interactive disclosure widget to toggle additional content. Content is hidden by default; only the summary (defined via <summary>) remains visible.

Both opening and closing tags are required.

Attributes:

open - Expands the section by default on page load.

Example

Code:

<details style="padding: 5px; border: 1px solid #ccc; border-radius: 4px;"> <summary style="cursor: pointer; font-weight: bold;">Click to learn more details</summary> <p style="margin-top: 10px; margin-bottom: 0;">This is hidden content appearing after clicking the header. The &lt;details&gt; tag creates a native accordion without JavaScript.</p> </details>

The browser will interpret this code as follows:

Click to learn more details

This is hidden content appearing after clicking the header. The <details> tag creates a native accordion without JavaScript.