- From: Tommy Hodgins via GitHub <sysbot+gh@w3.org>
- Date: Thu, 05 Dec 2019 16:38:17 +0000
- To: public-css-archive@w3.org
I can immediately see the value of both `sibling-count()` and `sibling-index()` and other related ideas too; in the past I've applied two similar concepts to styling: - index of this tag amongst its siblings (the children of its `parentElement`) - index of this tag amongst the list of tags in the document matching a given selector (similar to index inside `querySelectorAll` results) For the second idea I've [made a plugin to help](https://www.npmjs.com/package/jsincss-tag-count) in the past, though now when I want to use this concept I usually reach for CSS custom properties and a little JS for a cleaner approach. Having the awareness of a tag's index inside `parentElement.children` or `document.querySelectorAll(selector)` in CSS natively, as well as the `parentElement.children.length` and/or `el.children.length` could simplify lots of existing tricky styles that have been built in much more complex ways! -- GitHub Notification of comment by tomhodgins Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4559#issuecomment-562209653 using your GitHub account
Received on Thursday, 5 December 2019 16:38:19 UTC