👀 Live Preview
Click the summary to toggle hidden content:
What is HTML?
HTML structures content on the web using elements like headings, paragraphs, and links.

The <summary> tag provides the clickable label for <details> disclosure widgets. This guide covers syntax, pairing with details, FAQ patterns, styling, and accessibility for beginners.
Visible heading for hidden content.
Must live inside details.
Native toggle behavior.
Question labels for answers.
class & global attributes.
Concise, descriptive labels.
<summary> Tag?The <summary> tag is an HTML element used with <details> to create an interactive disclosure widget. It serves as the heading or brief description for content hidden inside details, giving users a concise overview they can click to expand.
Place summary as the first element inside details. The browser renders it as the clickable toggle control for the hidden content that follows.
No JavaScript is required — browsers handle expand and collapse natively, making summary ideal for FAQs, optional content, and clean UI design.
Embed summary inside opening and closing details tags:
<details>
<summary>Your summary here</summary>
<!-- Hidden content here -->
</details><details>
<summary>Show More</summary>
<p>Your additional content goes here.</p>
</details>summary must be the first child of details for correct behavior.<summary />) is not valid in HTML.summary per details element.| Topic | Code Snippet | Notes |
|---|---|---|
| Basic pair | <details><summary>...</summary> | Required parent |
| FAQ question | <summary>How does it work?</summary> | Question label |
| Styled label | class="highlight" | Global attr |
| Open by default | <details open> | On parent |
| vs details | summary = label | details = widget |
| Browser support | Modern browsers | IE limited |
<summary> vs <details>| Element | Role | Notes |
|---|---|---|
<summary> | Clickable label / heading | Always inside details |
<details> | Disclosure container | Holds summary + hidden content |
| Attributes | open, name on details | summary uses global attrs only |
| JavaScript | Not required | Native browser toggle |
The <summary> tag has no tag-specific attributes. Use global attributes like class and id for styling and customization.
<details>
<summary class="highlight">Your Styled Summary</summary>
<p>Hidden content here.</p>
</details>class / id GlobalHook for CSS styling the disclosure label.
class="highlight"style GlobalInline color or font-weight for the summary label.
style="color: #dc2626"title OptionalAdvisory tooltip for extra context on the label.
title="Click to expand"open (on details) ParentExpand content by default using open on the parent details element.
<details open>Styled labels, expand/collapse toggles, and FAQ questions with copy-ready code and live previews.
Click the summary to toggle hidden content:
HTML structures content on the web using elements like headings, paragraphs, and links.
Use <summary> to label expandable content in details widgets for FAQs, optional sections, and compact page layouts.
Apply a class to customize the appearance of the summary label:
<details>
<summary class="highlight">Your Styled Summary</summary>
<p>This is the hidden content that appears when you click the summary.</p>
</details>The primary purpose of summary is to let users expand and collapse content within details:
<details>
<summary>Show More</summary>
<p>Your additional content goes here.</p>
</details>The details and summary combination is often used for FAQ sections, letting users reveal answers to specific questions:
<details>
<summary>How does it work?</summary>
<p>Explanation of how it works...</p>
</details>The label is the first child of details.
Summary appears as a clickable disclosure triangle or marker.
Hidden content inside details is shown or hidden.
Users explore additional information at their own pace without JavaScript.
The <summary> tag is fully supported in all modern browsers. Legacy Internet Explorer has partial or no support.
Modern browsers render <summary> with built-in expand/collapse behavior.
Bottom line: Use <summary> with <details> confidently in all modern browsers.
Mastering the <summary> tag empowers you to create interactive, user-friendly disclosure widgets. Combined with <details>, it offers a seamless native experience for FAQs and expandable content without JavaScript.
summary content concise and descriptivesummary as the first child of detailssummary outside of detailssummary elements in one details<summary>Bookmark these before you build disclosure widgets.
Toggle heading.
PurposeRequired parent.
PairingNative toggle.
BehaviorQ&A labels.
Use caseStyle labels.
Attributes98% support.
Compatibilitydetails disclosure widget. Users click summary to show or hide the content below.summary must be inside details as its first child to function correctly.summary is paired with details.class, id, and style.details and summary.Practice <summary> with <details> for FAQs and toggle content in the Try It editor.
6 people found this page helpful