Skip to content
Related Articles

Related Articles

How to define additional details that the user can view or hide?
  • Last Updated : 11 Jun, 2020

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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


Output:
Before clicking on details Element:

After Clicking On Button:

Supported Browsers are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari

full-stack-img

My Personal Notes arrow_drop_up
Recommended Articles
Page :