HTML <summary> Tag

Beginner
5 min read
Updated: Nov 2026
4 examples
Live preview

Definition and Usage

The <summary> element is the visible label for a <details> disclosure widget. Activating it toggles the parent open or closed.

Put <summary> as the first child of <details>. Its text is the accessible description for the widget. Start expanded with open on <details>, not on <summary>.

Baseline · Widely available.

Core <details> / <summary> has been widely available since about January 2020. Some styling hooks vary by browser.

Warning: headings inside summary.

Some browsers expose summary like a button and strip roles from children. Prefer plain text or <strong>; test if you nest headings.

Non-standard: ::-webkit-details-marker.

Safari-oriented marker styling. Prefer standard ::marker where possible, and test both.

HTML Syntax

syntax.html
<details><summary> label</summary> …content… </details>

Both start and end tags are required. Content is phrasing content (optionally with heading content). Parent must be <details>.

Attributes

<summary> has no element-specific attributes. Use globals when needed. Open/closed state belongs on the parent <details>:

AttributeDescriptionTry it
classOptional CSS hook for the labelTry it
idUnique identifier for linking or scriptingGlobal attr
open (on details)Boolean on <details> — start expandedTry it

Global Attributes

The <summary> tag also supports the Global Attributes in HTML.

Live Preview

Click the summary label below — no JavaScript required for the toggle.

The <summary> is the clickable label; content lives in <details>.

Result
I have keys but no doors. What am I?

A keyboard.

Starts closed — click the summary to reveal the answer.

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Basic <summary>

Put the label first inside <details>, then the hidden content.

HTML
<details>
  <summary>Shipping times</summary>
  <p>Orders usually ship within 2 business days.</p>
</details>
Try It Yourself

How It Works

  1. Open <details> as the disclosure container.
  2. Add <summary> first with a short, clear label.
  3. Place the body content after </summary>.
  4. Click the summary to toggle open and closed — no script needed.

Example 2 — Start Open

Put open on <details> so the panel begins expanded.

HTML
<details open>
  <summary>Overview</summary>
  <ul>
    <li>Cash on hand: $500.00</li>
    <li>Due date: May 6</li>
  </ul>
</details>
Try It Yourself

How It Works

  1. Add the Boolean open on <details>.
  2. Keep summary first so the label stays visible.
  3. Users can still close it by activating the summary again.
  4. To start closed, omit open entirely — do not use open="false".

Example 3 — Emphasized Label

You can nest phrasing content such as <strong> inside the summary.

HTML
<details>
  <summary><strong>Important:</strong> Backup tips</summary>
  <p>Export your files before you reinstall.</p>
</details>
Try It Yourself

How It Works

  1. Keep the label short so it scans well when closed.
  2. Wrap key words in <strong> if needed.
  3. Avoid relying on headings inside summary for outline structure.
  4. Test with a screen reader if the label is complex.

Example 4 — Simple FAQ List

Stack several details / summary pairs for a lightweight FAQ.

HTML
<details>
  <summary>Do I need an account?</summary>
  <p>No. Guests can check out.</p>
</details>
<details>
  <summary>How long is shipping?</summary>
  <p>Usually 3–5 business days.</p>
</details>
Try It Yourself

How It Works

  1. One question per summary keeps each panel clear.
  2. Put the answer in the matching details body.
  3. Each widget toggles alone unless you group with name on details.
  4. Write natural questions — the summary is what users always see.

Edge Cases & Pitfalls

Most summary bugs come from wrong placement or treating it like a free-standing heading.

parent

Must be first child of details

Do not put <summary> alone on the page or after other content inside details.

omit

Missing summary = default label

Without summary, browsers often show “Details”. Always write a real label.

a11y

Be careful with nested headings

Heading roles inside summary can be lost in some browsers. Prefer text or strong when in doubt.

open

open is on details

There is no open attribute on summary. Presence of open on details means expanded.

marker

Triangle styling varies

Default display: list-item enables a disclosure marker. Customize with ::marker; WebKit may need extra care.

Browser Support

The <summary> element is core HTML used with <details>. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available

<summary>

Widely available with details since about January 2020. Chrome, Firefox, Safari, Edge, and Opera support the basic disclosure pattern.

96% Global support (approx.)
Google Chrome All modern
Full support
Mozilla Firefox All modern
Full support
Apple Safari All modern
Full support
Microsoft Edge All modern
Full support
Opera All modern
Full support
Samsung Internet All modern
Full support
Internet Explorer —
Not supported
<summary> Widely supported

Bottom line: Safe for modern browsers as a details label. Always provide a clear summary text, and test accessibility if you nest complex markup.

Key Takeaways

  • Role: <summary> is the clickable label for <details>.
  • Placement: first child of details — nowhere else.
  • State: use open on details to start expanded.
  • No JS needed: the browser toggles when the summary is activated.

One line: write a clear <summary> as the first child of <details>.

Default CSS Settings

Typical user-agent styling (enables the disclosure marker):

default.css
summary {
  display: list-item;
}

Set list-style: none or change ::marker to customize (or hide) the triangle. Behavior can differ slightly across browsers.

Frequently Asked Questions

The summary element is the visible label for a details disclosure widget. Clicking it opens or closes the parent details.
Only as the first child of a details element. Outside details, summary is invalid for this purpose.
No. summary only supports the global attributes. The open state lives on the parent details element.
Browsers often show a default label such as "Details". Always provide a clear summary for users and accessibility.
Yes technically, but some browsers treat summary like a button and strip heading roles from children. Prefer plain text or strong, and test with assistive tech.
No for basic open/close. The browser toggles details when summary is activated. Listen for toggle on details only if you need scripting.

Next: sup

Learn the superscript element for exponents and ordinals.

sup tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

12 people found this page helpful