Skip to content
Web Design & Development

The details and summary Elements: The Decisions That Matter

Native HTML elements that create an expandable disclosure widget, where the summary is always visible and the rest of the content toggles open and closed.

MediaScaleUp Editorial Team 2 min read 13 views
The details and summary Elements: The Decisions That Matter

What is at stake

They provide accessible, keyboard-operable accordions and FAQs with no JavaScript, and the content remains searchable with find-in-page.

The playbook

  1. Use details for FAQs and optional information
  2. Write summaries that describe the hidden content
  3. Use the name attribute for exclusive accordions
  4. Style the marker consistently with the design
  5. Keep essential content visible rather than hidden

Where it goes wrong

Avoid:

  • Custom accordion scripts for simple disclosures
  • Hiding critical information inside closed sections
  • Summaries such as click here
  • Removing the focus style from summary
What to do and what to avoid with the details and summary elements, side by side
Good practice against the usual mistakes, from the sources listed below.

The numbers behind it

Published figures for The details and summary Elements
MeasureFigure
Structurea details element containing a summary as its first child
Open statethe open attribute
Exclusive accordionsdetails elements sharing a name attribute open one at a time
Find in pagebrowsers can open closed details to reveal search matches

Getting outside help

When to hand it over: Bring in help when building FAQ or accordion components for a design system.

Where this comes from

The figures and practices above come from the sources listed.

Working on something like this?

We take on Web Design & Development work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.

Where to go next

Spotted something wrong? Report an error on this page. We correct on the page and say what changed.

All services

The work behind this article, and what it costs.

MediaScaleUp Editorial Team

Articles here are researched, written and checked by the MediaScaleUp studio team before they are published, and dated when they are reviewed.

Keep reading

More in Web Design & Development