<details>
Tag TutorialHTML <details>
Tag Tutorial
The <details>
tag in HTML is used to create a disclosure widget that can be toggled open and closed, showing or hiding the additional content inside it. This tag is commonly used to create collapsible sections on a webpage.
How to use the <details>
tag:
<details>
<summary>Click me to toggle the details</summary>
Additional content goes here...
</details>
This code will generate a disclosure widget with a summary that can be clicked to show or hide the additional content inside the <details>
tag.
Main attributes of the <details>
tag:
Attribute | Description |
---|---|
open |
Specifies that the details should be visible (open) by default |
Example usage of the <details>
tag:
<details>
<summary>Fictional Data Example</summary>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<p>Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
</details>
This code will create a disclosure widget with a summary "Fictional Data Example" that can be clicked to show the Lorem Ipsum text inside it.