๐Ÿช— HTML

Native HTML Accordions with details/summary โ€” Zero JavaScript

๐Ÿ“… Jul 3, 2026 โฑ 3 min read

Every FAQ section and our entire interview question bank runs on two tags and zero JavaScript.

The whole component

<details>
  <summary>What is the pass mark?</summary>
  <p>50/100 combining internal and external assessment.</p>
</details>

<!-- exclusive group โ€” opening one closes others (modern browsers) -->
<details name="faq">...</details>
<details name="faq">...</details>

Styling it properly

summary { cursor: pointer; list-style: none; }      /* remove default arrow */
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; float: right; }
details[open] summary::after { content: "โˆ’"; }
details[open] p { animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } }

Why it beats JS accordions

Find-in-page (Ctrl+F) even auto-opens matching closed details in Chrome.

โ† All Articles