HTML <summary> Tag

<summary> tag is used to define the visible header for the <details> element. By clicking on the header the user can view/hide the information.

<summary> element always should be the first element inside <details> tag.

<summary> tag is new to HTML5. It is not supported by the browsers Internet explorer and Edge.

Syntax

The content of the tag is between the opening (<summary>) and closing (</summary>) tag.

Example

<!DOCTYPE html>
<html>
  <body>
    <details>
      <summary>Copyright 2013-2014.</summary>
      <p> W3docs. All rights reserved.</p>
      <p>The content of the website is the property of W3Docs.com.</p>
    </details>
  </body>
</html>

Attributes of <summary> tag

<summary> tag supports Global Attributes.