asp.net.ph

Skip Navigation LinksHome > Abakada: Back to Basics > Language References > HTML Elements > SUMMARY Element

<summary> Element


Represents a legend or caption for the <details> element.HTML 5

HTML Syntax

NOTE: Both start and end tags are required.

Remarks

The <summary> element defines a visible heading, caption or legend for the <details> element.

The content of the summary tags can be activated ( typically by a mouse click ) to show or hide the content of the corresponding details element.

As per the HTML standard, the summary element displays as a list-item. This makes it possible to change or remove the list-item marker displayed next to the caption.

The marker is typically rendered as a small triangle that rotates or twists to indicate an open or closed state. The user can open and close the widget on demand by clicking on the caption next to the marker.

If not specified, user agents normally provide its own caption or label for the summary tags.

NOTE: This element can only be used within the <details> element.

Attributes

The <summary> element has no attribute of its own, but supports global attributes common to all HTML elements.

Example

The following example shows how the <summary> element may be used.

<details>
   <summary>Legend or label here</summary>
   <p>More information about the legend here.</p>
</details>

which would render on a Web page as follows:

Legend or label here

More information about the legend here.

The following example shows use of the name attribute to group related details elements.

<details name=groupName>
   <summary>Legend for details1 here</summary>
   <p>More information about details1 here.</p>
</details>
<details name=groupName>
   <summary>Legend for details2 here</summary>
   <p>More information about details2 here.</p>
</details>
<details name=groupName>
   <summary>Legend for details3 here</summary>
   <p>More information about details3 here.</p>
</details>

which would render on a Web page as follows:

Legend for details1 here

More information about details1 here.

Legend for details2 here

More information about details2 here.

Legend for details3 here

More information about details3 here.

And here is an example of using CSS to customize the appearance of the <summary> element.

 Show me 

External References

See Also

DETAILS


Need a break ?
Suggested Reading

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph.

If you have any question, comment or suggestion,
please send us a note