HTML Tags

HTML5 <details> Tag

Topic: HTML5 Tags ReferencePrev|Next

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: New in HTML5

Syntax

The basic syntax of the <details> 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.

Attribute Value Description
open open This Boolean attribute specifies whether the details will be visible to the user on page load. Default value is false, so the details will be hidden.

Global Attributes

The <details> tag supports the global attributes in HTML5.


Event Attributes

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


Browser Compatibility

The <details> tag is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox ×
  • Google Chrome 12+
  • Internet Explorer ×
  • Apple Safari 6+
  • Opera 15+

Further Reading

See tutorial on: HTML Text Formatting.

Related tags: <bdo>.

Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties