Re: [csswg-drafts] [css-values] Proposal: add sibling-count() and sibling-index() (#4559)

@jakearchibald `child count - 1` is a value I use in Splitting demos frequently for getting a “percentage” like decimal (range from 0 to 1 of the child’s index relative to the total). Here's a quick example from the initial `sibling-count()` discussion where I use that "child count - 1" value to stagger an `animation-delay` over the course of 2s.
```
animation-delay: calc( 2s * ( var(--sibling-index) / var(--sibling-count) ) );
```
https://codepen.io/shshaw/pen/LYEEKMQ

This can of course be achieved by doing `child-count() - 1`, but if we're calling it the count of the siblings then it seems odd that it would include the element itself. I do find the `- 1` value very useful in my instances, but I'm not beholden to a `- 1` value if there's a strong case against, or if this is just a difference in semantics. 


-- 
GitHub Notification of comment by shshaw
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4559#issuecomment-562169143 using your GitHub account

Received on Thursday, 5 December 2019 15:06:13 UTC