The <details> and <summary> elements form what the HTML specification calls a disclosure widget. Expand-and-collapse behavior ships with the markup, so no JavaScript or CSS is required to produce a working accordion. The default presentation, however, has a pair of rough edges that are worth handling in a stylesheet's reset section.
Issue one: the wrong cursor on <summary>
Hovering an interactive element should show a cursor that reflects what the user can do with it. A <summary> behaves much like a link or a form button, yet browsers give it the text cursor — the one expected when selecting or entering text. The fix is a single declaration:
details summary {
cursor: pointer;
}
The default is plausibly meant to signal that the summary's text can be selected along with the rest of the widget's content. That trade-off isn't necessary: setting cursor: pointer only changes appearance, and the text remains selectable afterward.
Larger sites already do this. The MDN Web Docs page for <details> applies the pointer value, and GitHub uses disclosure widgets for actions such as watching, starring and forking a repository.
Issue two: block-level content in <summary>
Authors often wrap the question of an FAQ entry in a heading tag chosen to fit the page outline. Putting a block-level element such as a heading directly inside <summary> causes the browser to push that content below the arrow marker instead of keeping it on the same line.
The workaround is to force nested content inline:
details summary > * {
display: inline;
}
Two cautions apply. Use inline rather than inline-block, because with inline-block the wrapping problem returns once the heading text spans more than one line. Also resist the temptation to swap <summary>'s default display: list-item for display: flex — that makes the arrow marker disappear entirely.
What the heading is worth
Nesting a heading brings consistent styling with the rest of the page, and it keeps the page structure valid in Internet Explorer and pre-Chromium Edge, which don't support <details> and render the content permanently visible rather than interactive. It can also aid navigation with assistive technology — but not reliably.
<summary> is an unusual element. It carries implicit role=button ARIA mapping, yet the spec allows headings to sit directly inside it. That creates a contradiction: headings there exist to help in-page navigation, while buttons strip the semantics from anything nested within them. Screen readers disagree on the outcome. NVDA and Apple's VoiceOver acknowledge headings inside <summary>; JAWS does not. You can style such a heading as a heading, but you cannot guarantee it will be interpreted as one. Including it probably does no harm; it just may not always help.
Scoping the reset to browsers that support <details>
Without polyfills for IE and EdgeHTML, applying custom disclosure widget styles to those browsers garbles the layout, and since the <summary> isn't interactive there, the default text cursor is the more accurate choice anyway. A feature query can keep the styles away from both engines:
@supports not (-ms-ime-align: auto) {
details summary {
cursor: pointer;
}
details summary > * {
display: inline;
}
/* Plus any other <details>/<summary> styles you want IE to ignore.
}
The query detects a property only those engines support. IE doesn't implement feature queries at all, so it skips the whole block; EdgeHTML does implement them, but won't apply anything inside, since -ms-ime-align is unique to that engine.
One caveat: older Chrome (versions 12–27) and Safari (versions 6–8 on macOS and iOS) support <details> but not feature queries, so they too will miss the custom styles. At the time of writing those browsers accounted for roughly 0.06% of global usage. An @supports selector(details) block would be the cleaner solution, but selector queries have even thinner browser support than property-based feature queries.
With the markup in place and both reset declarations added, disclosure widgets can be dressed up with borders, background colors and other styling. Customizing the summary markers themselves, though, is a more involved job.



