How to define additional details that the user can view or hide?
In this article, we define additional details that the user can view or hide By using the details Element in The Document, It 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 an interactive widget that the user can open or close it. The content of the details tag is visible when open the set attributes.
Syntax:
<details> <summary> Text content </summary> <div> Content . . . </div> </details>
Example:
<!DOCTYPE html> < html > < head > < title > Define additional details that the user can view or hide. </ title > < style > summary { font-size:40px; color:#090; font-weight:bold; } </ style > </ head > < body > < h2 > Define additional details that the user can view or hide </ h2 > < 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 > |
chevron_right
filter_none
Output:
Before clicking on details Element:
After Clicking On Button:
Supported Browsers are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Opera
- Safari