Description

The <details> element represents a control from which the user can obtain additional information on-demand. It can be used to create an interactive widget that the user can show or hide (like expand and collapse) to retrieve the additional information or controls. Any sort of element can be placed inside the details element.

The following table summarizes the usages context and the version history of this tag.

Placement:Block
Content:Block, inline and text
Start/ End Tag:Start tag: required , End tag: required
Version:5

Syntax

The basic syntax of the <body> tag is given with:

HTML/XHTML: <details> ... </details>

The example below shows the <details> tag in action.

<details>
    <summary>What is HTML?</summary>
    <p>HTML is a markup language for describing the structure of web pages.</p>
</details>

Note: You may (and should) provide alternate content inside the <details> element. That content will be rendered both on older browsers that don't support details and in browsers with JavaScript disabled.

Tag-Specific Attributes

The following table shows the attributes that are specific to the <details> tag.

Global Attributes

Like all other HTML tags, the <details> tag supports the global attributes in HTML5.

Event Attributes

The <details> tag also supports the event attributes in HTML5.

Browser Compatibility

Element
<body>YesYesYesYesYes