About this set
Three trees that do with CSS what many tree plugins do with JavaScript. Animated open with ::details-content is a recipe box whose branches grow open and fold shut: the ::details-content pseudo-element transitions its block size from zero to auto, made possible by interpolate-size allow-keywords, together with a discrete transition on content-visibility. The whole rule sits inside @supports, so browsers without these features simply open the branch at once. Open branches and current trail with :has() is a course syllabus where any list item that holds an open details element gets a tinted panel, the module that contains the current lesson gets a dot through summary:has(+ul [aria-current]), and a hint appears when every module is folded, all without classes or script. One branch at a time with details name is a store settings menu where the top-level details share one name attribute, so the browser closes the open section when another opens, an exclusive accordion with no JavaScript. All three are written in native CSS nesting.
What’s included
- Animated open and close with ::details-content and interpolate-size
- Open branch panels and current-page trail styled with :has()
- Exclusive branches with the details name attribute
- Written in native CSS nesting, no JavaScript
- Falls back to an instant open where the animation is not supported
Accessibility
Every branch is a summary element, announced as expandable with its state and operated with Tab, Enter and Space. The current lesson link carries aria-current page. Summaries and links show a 2px green outline on keyboard focus, the white current link on green meets 4.5:1, and under prefers-reduced-motion the open animation and chevron rotation are switched off.
Customise it
Set --mx-accent, --mx-panel, --mx-hover and --mx-line on .mx, and change the .28s durations in the @supports block for a faster or slower open. To make another group exclusive, give its details elements the same name value.






