According to the Specification WHATWG HTML5:
The Details element represents a Disclosure widget from which the user
can obtain Additional information or Controls.
The element details
is intended to create a widget that is intended to provide the user with additional information about a content or reveal a form control.
In this context, two elements are relevant, the <details>
, which is the container for all contents to show/hide and the <summary>
, which contains the summary and title of the section, which is optional, because if not used, the browser will render a standard text for the element.
With the <details>
you can change the visibility of comments in a blog, user profiles, download details, complex forms or in web applications as shown in the following example, in the specifications:
To style the widget in enginesWebKit
you can use the pseudo CSS class ::-webkit-details-marker
.
details summary::-webkit-details-marker {
background: red;
color: #fff;
font-size: 500%;
}
To better understand, read the full article here.