Skip to content
Tutorials Center
My learning

Topics

HTML Reference ยท Interactive Elements

The <summary> element

Reference for the HTML <summary> element: the clickable label of a <details> widget, what it may contain, marker styling, accessibility and technical details.

The <summary> element is the label of a <details> widget. It stays visible while the rest of the widget is collapsed, and activating it, by click, tap, Enter or Space, toggles the parent open or closed. It only does this when it is the first child of a <details> element.

HTML
<details>
  <summary>Ingredients</summary>
  <ul>
    <li>2 cups flour</li>
    <li>1 egg</li>
  </ul>
</details>

Try it

Summary labels and a custom marker

Attributes

This element has no attributes of its own. It accepts the global attributes, such as class, id and lang.

Usage notes

  • Keep it short and descriptive. The summary is read aloud as the control's name, so "Delivery options" is better than "Click here for more".
  • No interactive content inside. Links, buttons or form fields inside a <summary> fight with its own click behavior and confuse assistive technology. Put them in the body of the <details> instead.
  • Headings are allowed. A summary may contain a heading along with phrasing content, which is handy for FAQ pages. Be aware that because the summary is exposed as a button, some screen readers announce it as a button and not as a heading.
  • Markers. Browsers render the summary as display: list-item, which produces the disclosure triangle. Style it with summary::marker, or remove it with list-style: none (plus summary::-webkit-details-marker for older Safari). If you change display to block or flex, the marker disappears.
  • Don't toggle it yourself. Clicking the summary changes the parent's open attribute. Listen for the toggle event on the <details> element instead of click on the summary.
  • Accessibility. Browsers expose the summary as an expandable control and announce whether it is expanded or collapsed. Don't add role="button" or aria-expanded yourself; the native semantics already cover it.

Technical summary

Content categories None
Permitted content Phrasing content, optionally intermixed with heading content (<h1>โ€“<h6>, <hgroup>)
Tag omission None; both the start and end tags are required
Permitted parents A <details> element, as its first child
Implicit ARIA role No corresponding role (browsers expose it as an expandable button-like control)
DOM interface HTMLElement
Default display list-item

Browser support

Supported in every current browser. Styling the marker with ::marker works everywhere today, while older Safari versions only respond to ::-webkit-details-marker.