The <details> tag is used for the content/information which is initially hidden but could be displayed if the user wishes to see it. This tag is used to create interactive widget which user can open or close it. The content of details tag is visible when open the set attributes.
Syntax:
<details> <summary> Text content </summary> <div> Content . . . > </details>
Example:
<!DOCTYPE html> < html > < head > < title >details tag</ title > < style > summary { font-size:40px; color:#090; font-weight:bold; } </ style > </ head > < body > < details > < summary >GeeksforGeeks</ summary > < p >A computer science portal for geeks</ p > < div >It is a computer science portal where you can learn programming.</ div > </ details > </ body > </ html > |
Output:
Attribute The detail tag has an attribute called open which is used to display the hidden information by default.
Syntax:
<details open> <summary> Text content </summary> <div> Content . . . > </details>
Example:
<!DOCTYPE html> < html > < head > < title >open attribute in detail tag</ title > < style > summary { font-size:40px; color:#090; font-weight:bold; } </ style > </ head > < body > < details open> < summary >GeeksforGeeks</ summary > < p >A computer science portal for geeks</ p > < div >It is a computer science portal where you can learn programming.</ div > </ details > </ body > </ html > |
Output:
Browser Support: Since this tag is included in HTML 5, so all the browsers does not support this tag.
The browsers which supports this tag are:
- Google Chrome 12.0 and above
- Safari 6.0 and above
- Opera 15.0 and above
This article is attributed to GeeksforGeeks.org
0
0
leave a comment
0 Comments