An ever-growing cheatsheet for HTML. I add things that I think are useful but difficult to unearth or understand.


  1. Add an accordion

Add an accordion

Use the HTML Details element (<details>). It’s built-in, well-supported, and easy to use.

    <summary>A frequently-asked question</summary>
    The expandable answer to that question, which can include any flow content.

You can even track events on the Details element.

CCS-Tricks has a good article on styling the Details element.