Re: [csswg-drafts] [css-values]: Expose `n` as a `<calc-constant>` (#8981)

I think most use cases presented in this issue and the mentioned `counter()` issue could be solved new **index variables** for the _n_-th any-child and _m_-th same-child, which can only be accessed and cannot be altered by authors. 
Some additional use cases (_n_-th-last, last, only) would be covered if the total counts of any-sibling and same-sibling were available as well, but my understanding is that these would be rather performance-expensive. 

Authors would have to recreate the effective calculations from the `counter-*` properties or from the `:*-child` and `:*-of-type` pseudoclasses within `calc()`, but in most cases this seems very doable – sometimes further calculation would have been needed anyway. 

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 18 June 2023 09:56:14 UTC