<summary>
<summary>
Tag
The <summary>
tag in HTML serves as a visible heading for the <details>
element. It functions as a clickable title that enables users to show or hide the content inside the <details>
element.
Syntax
<details>
<summary>Summary text</summary>
<p>Additional details go here.</p>
</details>
<summary>
Demo
Click to view more information
This is the additional information that appears when you click the summary.
<details>
<summary>Click to view more information</summary>
<p>
This is the additional information that appears when you click the summary.
</p>
</details>
Attributes
- This element supports all the attributes.
Key Points
The <summary>
tag provides a concise, clickable description for the content inside the <details>
element.
- The
<details>
element can be expanded or collapsed, making it useful for interactive sections such as FAQs or hidden content. - By default, the content inside
<details>
is hidden. Clicking the<summary>
reveals or hides it.
See Also
<details>
Conclusion
The <summary>
tag provides a clickable heading for the <details>
element, allowing users to reveal or hide additional content. This feature is particularly useful for creating interactive sections like FAQs or hidden information. By default, the content within <details>
is hidden, and clicking the <summary>
tag toggles its visibility.
<select>
The HTML <select> element generates a dropdown menu that lets users select from a list of choices, with individual options specified using <option> elements.
<textarea>
The HTML <textarea> element generates a multi-line input field for users to enter text, providing a flexible space for longer input. It includes attributes such as rows, columns, and placeholder text to enhance user experience.