HTML <details> Tag
To define the additional details, to be displayed on demand on a web page, the HTML <details> tag is used. It was introduced in HTML5. The user can view or hide the additional details. The HTML <details> tag is used as a disclosure widget, as per the W3C HTML specification. The user can retrieve additional information or control from it. The HTML <summary> tag is also used with the HTML <details> tag to define the summary and the title of the section.
<!DOCTYPE html> <html> <body> <details> <summary>Apple</summary> <p>Apple is a fruit.</p> <p>An Apple a Day keeps the Doctor away.</p> </details> </body> </html>
In the above example, we are using the <details> tag to add the additional details on a topic.
Tag Specific Attributes:
|open||Used to specify that the details are open for the user, i.e, the user can view the details.|
The HTML Global attributes are supported by the HTML <details> tag.
The HTML Event attributes are supported by the HTML <details> tag.
Chrome, Firefox, Opera and Safari.