Content · Web Development · HTML

HTML <summary> Element: Reference and Examples

A clear, practical element reference to summary. Learn when to use it, see working HTML, and avoid common mistakes.

1 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

The <summary> element is used for provide the clickable heading for details. You will run into it while reading other people’s HTML, and it is useful to know what job it does before copying the code.

What does <summary> mean?


Provide the clickable heading for details. The tag gives the browser a specific kind of content to work with. It is more helpful to choose a tag for its meaning than because of its default look.

The summary is the accessible toggle label for its parent details element.

A working HTML example


Here is a small example you can place in an HTML page and inspect in your browser:

<details>
    <summary>What happens if I forget my password?</summary>
    <p>Use the password reset page to request a new link.</p>
</details>

Reading the example


Find the <summary> part first. Notice which elements are around it and how its content or attributes are connected to those other elements.

In this example, <summary> appears alongside details. That context is often just as important as the element itself.

The browser builds its document from these relationships. Any CSS changes appearance, while interactive JavaScript behavior must be provided separately when the example includes it.

When should you use it?


Use <summary> when you want to provide the clickable heading for details. A sensible example of this on a real website is the markup shown above; it gives the browser and accessibility tools a clearer job to work with.

Common companions are details. Check the nesting requirements before moving the element into a different location.

Try it yourself


Add two details elements and verify that both respond to keyboard activation.

Common Beginner Mistakes


  • Do not make summary a free-standing button unrelated to details.
  • Picking <summary> only because it looks a certain way instead of checking what it means.
  • Forgetting to inspect the surrounding markup when an element does not behave as expected.

Key Takeaways


  • <summary> helps provide the clickable heading for details.
  • The summary is the accessible toggle label for its parent details element.
  • Start with meaningful markup, then add styling or scripting only when the page needs it.
Share this resourceSend this page to someone who may find it useful.