CSS Tree-Counting Functions
The `sibling-index()` and `sibling-count()` functions, which expose an element's position and sibling total to CSS calculations.
Content tagged tree-counting-functions
Tutorial:CSS-Only Staggered Animations with sibling-index() and sibling-count()
Stagger animations from each element's own position, without JavaScript.sibling-index() and sibling-count() give an element its own 1-based position and its sibling total directly inside calc() — replacing the JavaScript loop that sets a --i custom property, with fixed-step and fixed-total staggers, index-driven colours and rotations, fallbacks, and reduced-motion handling.