CKTIS / CSS
::details-content — expandable content
The ::details-content pseudo-element styles the expandable portion of a details element without targeting its summary.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
details::details-content { /* declarations */ }
details[open]::details-content { /* declarations for the open state */ }::details-content targets the expandable content of a details element, not its summary. It is an element-backed pseudo-element with no restriction on which CSS properties apply.
The selector details[open]::details-content limits styling to the open state. ::details-content alone does not mean the content is currently expanded.
By default, closed content has content-visibility: hidden. This hides its contents, but the pseudo-element’s borders or margins can remain visible. The example therefore applies decoration only with [open].
Examples
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>::details-content example</title>
<style>
details[open]::details-content {
padding: 12px;
border: 2px solid #224488;
background-color: #eef4ff;
}
</style>
<details open>
<summary>More information</summary>
<p>Expandable content.</p>
</details>
</html>Result
Initially: “More information” and “Expandable content.” are visible. The expandable content has 12px padding, a 2px solid #224488 border, and a #eef4ff background. After closing: only “More information” remains visible.
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.