HTML
An ever-growing cheatsheet for HTML. I add things that I think are useful but difficult to unearth or understand.
Contents
Add an accordion
Use the HTML Details element (<details>
). It’s built-in, well-supported, and easy to use.
<details>
<summary>A frequently-asked question</summary>
The expandable answer to that question, which can include any flow content.
</details>
You can even track events on the Details element.
CCS-Tricks has a good article on styling the Details element.