• Skip to main content
  • Skip to search
  • Skip to select language
MDN Web Docs
  • References
    • Overview / Web Technology

      Web technology reference for developers

    • HTML

      Structure of content on the web

    • CSS

      Code used to describe document style

    • JavaScript

      General-purpose scripting language

    • HTTP

      Protocol for transmitting web resources

    • Web APIs

      Interfaces for building web applications

    • Web Extensions

      Developing extensions for web browsers

    • Accessibility

      Build web projects usable for all

    • Web Technology

      Web technology reference for developers

  • Learn
    • Overview / MDN Learning Area

      Learn web development

    • MDN Learning Area

      Learn web development

    • HTML

      Learn to structure web content with HTML

    • CSS

      Learn to style content using CSS

    • JavaScript

      Learn to run scripts in the browser

    • Accessibility

      Learn to make the web accessible to all

  • Plus
    • Overview

      A customized MDN experience

    • AI Help

      Get real-time assistance and support

    • Updates

      All browser compatibility updates at a glance

    • Documentation

      Learn how to use MDN Plus

    • FAQ

      Frequently asked questions about MDN Plus

  • Curriculum New
  • Blog
    • Playground

      Write, test and share your code

    • HTTP Observatory

      Scan a website for free

    • AI Help

      Get real-time assistance and support

  • Log in
  • Sign up for free
  1. References
  2. HTML
  3. Reference
  4. Elements
    • Deutsch
    • Français
    • 日本語
    • Português (do Brasil)
    • Русский
    • 中文 (简体)

In this article

  • Try it
  • Attributes
  • Usage notes
  • Examples
  • Technical summary
  • Specifications
  • Browser compatibility
  • See also
  1. HTML
  2. Guides
  3. Content categories
  4. Comments
  5. Date and time formats
  6. Constraint validation
  7. Viewport meta element
  8. Responsive images
  9. Microdata
  10. Microformats
  11. Quirks and standards modes
  12. HTML cheatsheet
  13. How to
  14. Define terms with HTML
  15. Use data attributes
  16. Use cross-origin images
  17. Add a hitmap on top of an image
  18. Author fast-loading HTML pages
  19. Add JavaScript
  20. Reference
  21. Elements
    1. Deprecated
    2. Deprecated

    3. Deprecated
    4. Deprecated
    5. Experimental
    6. Deprecated
    7. Deprecated
    8. Deprecated

Summaries as headings

You can use heading elements in

, like this:

html

Overview

  1. Cash on hand: $500.00
  2. Current invoice: $75.30
  3. Due date: 5/6/19

Result

This currently has some spacing issues that could be addressed using CSS.

Warning: Because the

element has a default role of button (which strips all roles from child elements), this example will not work for users of assistive technologies such as screen readers. The

will have its role removed and thus will not be treated as a heading for these users.

HTML in summaries

This example adds some semantics to the

element to indicate the label as important:

html
Overview
  1. Cash on hand: $500.00
  2. Current invoice: $75.30
  3. Due date: 5/6/19

Result

Changing the summary's icon

The

element's marker, the disclosure triangle, can be customized with CSS. The marker can be targeted using the ::marker pseudo-element. which accepts the list-style shorthand property and its longhand component properties, such as list-style-type. This enables changing the triangle to an image (usually with list-style-image) or a string (including emojis). In this example, we replace the content of one disclosure widget and remove the icon from another by setting list-style: none before adding a custom disclosure icon via generated content.

CSS

In the first disclosure widget, we style the ::marker, changing the content based on the

element's [open] attribute. For the second widget, we remove the marker with list-style properties, then add styled generated content with the ::after pseudo-element. We also include styles for ::-webkit-details-marker to target Safari. The selector for the browser-specific pseudo-element is included in an :is() pseudo-class so it doesn't invalidate the selector list.

css
details {
  font-size: 1rem;
  font-family: "Open Sans", Calibri, sans-serif;
  border: solid;
  padding: 2px 6px;
  margin-bottom: 1em;
}

details:first-of-type summary::marker,
:is(::-webkit-details-marker) {
  content: "+ ";
  font-family: monospace;
  color: red;
  font-weight: bold;
}

details[open]:first-of-type summary::marker {
  content: "− ";
}

details:last-of-type summary {
  list-style: none;
  &::after {
    content: "+";
    color: white;
    background-color: darkgreen;
    border-radius: 1em;
    font-weight: bold;
    padding: 0 5px;
    margin-inline-start: 5px;
  }
  [open] &::after {
    content: "−";
  }
}
details:last-of-type summary::-webkit-details-marker {
  display: none;
}

The CSS includes the [open] attribute selector, matching only when the open attribute is present (when the

are open). The :first-of-type and :last-of-type pseudo-classes target the first and sibling elements of the same type. We included the prefixed -webkit- pseudo-element within a :is() pseudo-class as it takes a forgiving selector list, so if the prefixed pseudo-element is invalid in a browser, the whole selector block will not be invalid. We also used CSS nesting. See the CSS selectors module.

HTML

html

Quotes from Helen Keller

On women's rights

We have prayed, we have coaxed, we have begged, for the vote, with the hope that men, out of chivalry, would bestow equal rights upon women and take them into partnership in the affairs of the state. We hoped that their common sense would triumph over prejudices and stupidity. We thought their boasted sense of justice would overcome the errors that so often fetter the human spirit; but we have always gone away empty-handed. We shall beg no more.

On optimism

Optimism is the faith that leads to achievement; nothing can be done without hope.

Result

Technical summary

Content categories none
Permitted content Phrasing content, optionally intermixed with Heading content
Tag omission None; both the start tag and the end tag are mandatory.
Permitted parents The
element.
Implicit ARIA role No corresponding role
Permitted ARIA roles No role permitted
DOM interface HTMLElement

Specifications

Specification
HTML
# the-summary-element

Browser compatibility

See also

Help improve MDN

Learn how to contribute.

This page was last modified on Jun 7, 2025 by MDN contributors.

View this page on GitHub • Report a problem with this content
MDN logo

Your blueprint for a better internet.

  • MDN on Bluesky
  • MDN on Mastodon
  • MDN on X (formerly Twitter)
  • MDN on GitHub
  • MDN Blog RSS Feed

MDN

  • About
  • Blog
  • Careers
  • Advertise with us

Support

  • Product help
  • Report an issue

Our communities

  • MDN Community
  • MDN Forum
  • MDN Chat

Developers

  • Web Technologies
  • Learn Web Development
  • MDN Plus
  • Hacks Blog
  • Website Privacy Notice
  • Cookies
  • Legal
  • Community Participation Guidelines

Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2025 by individual mozilla.org contributors. Content available under a Creative Commons license.