The details tag
The details tag creates a spoiler in HTML, i.e. it is used for information that can be hidden or shown at the user's discretion.
By default, the tag's content is hidden; to display it on user demand, add the summary tag, which specifies a title for the details tag. This title is always visible on the page (even if the details content is collapsed) and can be clicked to expand the hidden text or collapse it.
You can also use the open attribute of the details tag to show hidden content (for example, to show the details content using JavaScript).
Example
Let's see how the details tag works:
<details>
<summary>click me</summary>
hidden text
</details>
:
See also
-
attribute
hidden,
which hides blocks on the page