Intro summary and details tags in HTML5

The <details> and the <summary> is the easiest way to create an accordean.

Show Spoiler

The Zebra did it!

Code…

<details>
    <summary>Show Spoiler</summary>
    <p>The Zebra did it!</p>
</details>

You can get it to work in line as well…

<style type="text/css">
.inline {
    display:inline;
}
.inline summary {
    display:inline;
    text-decoration: underline;
    text-decoration-style: dotted;
}
.inline span:before {
    content:"(";
}
.inline span:after {
    content:")";
}
</style>

<div>I want to learn
<details class="inline">
    <summary>HTML</summary>
    <span>Hyper Text Markup Language</span>
</details>
tomorrow</div>
Author: Binny V A
A philosopher programmer who specializes in backend development and stoicism.

Leave a Reply

Your email address will not be published. Required fields are marked *