MDN wants to learn about developers like you:

我們的志工尚未將本文翻譯為 正體中文 (繁體) 版本。加入我們,幫忙翻譯!
您也可以閱讀本文的 English (US) 版本。

The HTML <details> element is used as a disclosure widget from which the user can retrieve additional information.

Content categories Flow content, sectioning root, interactive content, palpable content.
Permitted content One <summary> element followed by flow content.
Tag omission None, both the starting and ending tag are mandatory.
Permitted parents Any element that accepts flow content.
Permitted ARIA roles None
DOM interface HTMLDetailsElement


This element includes the global attributes.

This Boolean attribute indicates whether the details will be shown to the user on page load. Default is false and so details will be hidden.


  <summary>Some details</summary>
  <p>More info about the details.</p>

<details open>
  <summary>Even more details</summary>
  <p>Here are even more details about the details.</p>


Note: If the live sample above doesn't work for you, see Browser compatibility to determine if your browser supports the feature at all.

Example with styling

Following the more recent spec, Firefox makes the summary element display: list-item and the marker can be styled the same way list items can be styled. Following an older spec, Chrome and Safari have a custom ::-webkit-details-marker pseudo element which can be styled.

For cross browser compatible styling hide Firefox's marker by setting summary { display: block } and Chrome and Safari's marker by setting ::-webkit-details-marker {display: none;}. Styling can then be applied in a way appropriate to the necessary styles. The example below uses CSS generated content to add the marker back.


  <summary>Some details</summary> 
  <p>More info about the details.</p> 


summary {
  display: block;

  summary::-webkit-details-marker {
  display: none;

summary::before {
  content: '\25B6';
  padding-right: 0.5em;

details[open] > summary::before {
  content: '\25BC';



Specification Status Comment
HTML Living Standard
The definition of '<details>' in that specification.
Living Standard  
HTML 5.1
The definition of '<details>' in that specification.
Recommendation Initial definition

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support 12 In Development 49.0 (49.0) No support 15 6
Feature Android Edge Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 4.0 In Development 49.0 (49.0) No support No support 6.1

Quantum CSS notes

  • Gecko has a bug meaning that <details> elements can't be made open by default using the open attribute if they have an animation active on them (bug 1382124). Firefox's new parallel CSS engine (also known as Quantum CSS or Stylo, planned for release in Firefox 57) fixes this.

See also