What is the difference between details and summary tag?

LAST READ: APR 15 2024 | Q. 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

Donate Us: Support to GDATAMART

LifeStyle & Fun

© 2024 GDATAMART.COM (All Rights Reserved)