HTML Details and Summary

#Details

  1. The details element represents a disclosure widget technically called as Accordion.
  2. It is a container tag.
  3. It is an inline level element.
  4. The details tag is used for the content/information which is initially hidden but could be displayed if the user wishes to see it.

#Summary

  1. The summary element is used to provide caption or title to the details (Accordion).
  2. It is a container tag.
  3. It is an inline level element.
  4. We have to use the summary tag within the details tag.

#Example

  1. <details> <summary>New Delhi</summary> It is the capital of India. </details>
  2. In the above example, the <details> tag creates an Accordion and the <summary> tag is used to provide title to it. When the user clicks on the summary, the content inside the <details> tag is shown.