VOOZH about

URL: https://www.geeksforgeeks.org/html/html5-details-tag/

⇱ HTML details Tag - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML details Tag

Last Updated : 6 May, 2026

The <details> tag in HTML creates a collapsible section that users can expand or hide to view additional content.

  • Used with the <summary> tag to show a clickable heading.
  • Content is hidden by default and expands on click.
  • The open attribute keeps it expanded by default.

Syntax

<details>
<summary>Click to view </summary>
<p> Additional content that can be shown or hidden.</p>
</details>

Attribute

  • details open: The <details> tag has an open attribute that displays the hidden content by default.

Event

  • toggle event: Triggered when the <details> element is opened or closed by clicking the <summary>, showing or hiding additional content.

Example: Using <details> Tag with open Attribute

Comment
Article Tags: