0% completed
In this lesson, you'll learn how to create sections that users can expand or collapse. This feature is very helpful when you want to hide extra information until it is needed, keeping your page clean and organized.
<details>
block. When users click on the caption, the block expands or collapses.<details> <summary>Clickable Caption</summary> Hidden content goes here. </details>
<summary>
tag is placed at the top of the <details>
tag.Below is a basic example that shows a simple collapsible section. The hidden content is only displayed when the user clicks the "More Info" caption.
Explanation:
<summary>
tag shows "More Info" as the clickable caption.<details>
are shown.Here is another example that uses <details>
and <summary>
to build a basic FAQ (Frequently Asked Questions) section.
Explanation:
<details>
sections are used, each with its own <summary>
.Using <details>
and <summary>
helps make your pages cleaner and more user-friendly by hiding extra information until it is needed. This is a handy tool when you want to organize content without overwhelming the reader.
.....
.....
.....