demo · v133
Staircase list & rotated pie
Add & remove items live; the indent, the opacity gradient, and the pie-slice rotations are all derived from sibling-index() / sibling-count() inside calc().
sibling-index() is not supported here. Needs Chrome 133+.
current: —
indented + faded list
- row
- row
- row
- row
pie with N coloured slices — angle is sibling-index() × 360deg/sibling-count()
the CSS
.stair li {
margin-left: calc(8px * (sibling-index() - 1));
opacity: calc(1 - 0.4 * (sibling-index() - 1) / max(sibling-count() - 1, 1));
}
.pie .slice {
transform: rotate(calc((sibling-index() - 1) * (360deg / sibling-count())));
}
Before sibling-index(), you'd write one nth-child(n) rule per child, or run a script that wrote --i custom properties onto each element. Neither scales.