Re: [csswg-drafts] [css-values] Function to retrieve index of element among siblings, or counter on element as integer (#1869)

This, along with a way to get the number of children in an element, would be really nice for staggered animations.

```css
.parent {
  --parent-children-count: children-count();
}
.parent .anim {
  /* Stagger from start to end */
  animation-delay: calc(sibling-index() * 100ms);
  /* Stagger from end to start */
  animation-delay: calc(var((--parent-children-count) - sibling-index()) * 100ms);
}
```

(@Nokel81 maybe the above shows that you don't need a special way to get values from the parent)

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

Received on Sunday, 3 November 2019 13:23:57 UTC