CSS Can Count Elements Now
CSS is gaining two new built-in functions — sibling-index() and sibling-count() — that let stylesheets know an element's position within its siblings and the total sibling count. This enables JavaScript-free staggered animations (by calculating animation-delay dynamically per element), dynamic color gradients across a list (using OKLCH with a computed progress value), and even complex 3D carousel layouts using trigonometry. The feature eliminates the need for hardcoded nth-child rules or JS loops for position-based styling. Browser support is currently limited and not yet available in Firefox.