summary – disclosure widget heading
<summary>Widget heading</summary>
The visible heading of a details widget. A click, Enter or Space opens and closes the widget. The browser draws an arrow in front of it that turns when it opens. It must be the first child of details; when it is missing, the browser adds the text “Details” (in the browser’s language).
- Default display:
display: list-iteminsidedetails(the arrow is its::marker) - End tag: required
- Content: phrasing content, optionally one heading
h1–h6 - Where it can be used:
details, as the first child - DOM interface:
HTMLElement
Attributes
Only global attributes.
Examples
A custom plus sign instead of the arrow:
<details class="plus"> <summary>Ingredients</summary> <p>Rye flour, water, salt, starter.</p> </details>
.plus summary {
list-style: none;
cursor: pointer;
font-weight: bold;
}
.plus summary::before {
content: "+ ";
}
Accessibility
A heading inside summary (<summary><h3>…</h3></summary>) helps navigating by headings, but some screen readers then do not read the heading as part of the button. Plain text is usually enough.
Things to watch out for
- Outside
details,summaryhas no function. - The arrow is removed with
list-style: none– and in Safari also with::-webkit-details-marker.
Browser support
Baseline – widely available: in all major browsers since January 2020, considered widely available since July 2022. Since version: Chrome 12, Firefox 49, Safari 6. As of October 2026 (MDN browser-compat-data).
Related:
details – disclosure widget
button – button
h1–h6 – headings