HTML5 <summary> Tag

The HTML <summary> tag is used as a summary, caption, or legend for the content of a <details> element. If the <summary> element is omitted, the heading “details” will be used.

The only content permitted inside this element is phrasing content or one element of heading content. Both the starting and ending tag are mandatory for this element. The parent of the <summary> tag can be the <details> element.

The following style is applied to this element by default:

summary {
  display: block;
}

Here is an example of using this tag:

<section class="progress window">
  <h4>Copying "Lord of The Rings"</h4>
  <details>
    <summary>Copying... <progress max="375505392" value="97543282"></progress> 25%</summary>
    <dl>
      <dt>Transfer rate:</dt> 
      <dd>452KB/s</dd>
      <dt>Local filename:</dt> 
      <dd>/home/movies/lord_ring.mp4</dd>
      <dt>Remote filename:</dt> 
      <dd>/home/fun/movies/lord_ring.mp4</dd>
      <dt>Duration:</dt> 
      <dd>02:56:27</dd>
      <dt>Color profile:</dt> 
      <dd>SD (6-1-6)</dd>
      <dt>Dimensions:</dt>
      <dd>1280×720</dd>
    </dl>
  </details>
</section>

Attributes

This element only accepts global attributes.

Examples

See the Pen HTML summary Tag by Tutorialio (@tutorialio) on CodePen.

Further Reading

  1. Read more about the HTML <summary> element on MDN.
  2. You can also read the HTML <summary> tag reference on W3C.

Reader Comments

1. You can register or login to post a comment. Asking readers to register improves the quality of discussion.

2. As a registered user, you will also get to access features like choosing between a light and dark theme or anything else that we might implement in future.

Follow Us For Updates

FacebookTwitterGoogle+
Go To Top