Native disclosure with summary first, and one open widget
<details>
<summary>Title</summary>
<p>Hidden until opened</p>
</details>
<details open>
<summary>Title</summary>
</details>summary is the first child and captions the widget. The open attribute shows the remaining content in the markup.
| Attribute | Description |
|---|---|
open | A boolean on details. When present, the widget is shown as open in the markup. Toggling is a user-agent behavior and was not executed here. |
name | Optional. In current HTML, details elements that share a name form an exclusive group. This is a newer feature, and it is not used in the example. |
- No script is attached. This fragment does not record a click, toggle event, or computed open state from a browser.
<details>
<summary>Shipping times</summary>
<p>Orders usually leave the warehouse in two business days.</p>
</details>
<details open>
<summary>Returns</summary>
<p>Unused items can be returned within 30 days.</p>
</details>What this markup means
Each details element has a summary as its first element child, which is the disclosure label. The first widget has no open attribute, so it is closed in the markup. The second has open, so its paragraph is shown in the markup. Opening or closing the widgets is left to a user agent and was not performed here.
Related: <dialog>, HTML tag catalog, HTML tutorial overview