Skip to content
Related Articles

Related Articles

Improve Article

How to define additional details that the user can view or hide?

  • Last Updated : 11 Jun, 2020
Geek Week

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>

Output:
Before clicking on details Element:

After Clicking On Button:

Supported Browsers are listed below:

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

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :