What is the difference between details and summary tag?

Asked By: Sarnath Bhagat

S

Sandeep Singh

Difference Between details and summary Tag


In HTML details tag and summary tag are used together to achieve the task. The combination of <details> tag and <summary> tag are generally used to provide additional details about anything in such a way so that it can be open or closed on click for reading the additional details.

Let's see how we can use details and summary tags in HTML


<details>

  <summary>Your Summary Heading</summary>

  <p>Your detailed description goes here, you can write any information here it will be hidden, only by expending anyone can see this information or message</p>

</details>



Main Difference Between details and summary Tag


  • <details> tag is used to provide additional information about anything whereas <summary> tag is used within <details> tag to provide the title/heading for <details> tag.
  • <details> tag can be used without <summary> tag whereas <summary> tag can't used without <details> tag.


You can see how the above example will appear when we run the above code on the HTML page.

difference between details and summary tag
0 votes

Your Answer

Email Us: advertise@gdatamart.com

Legal Policy

International

© 2022 GDATAMART.COM (All Rights Reserved)