[csswg-drafts] [css-selectors] Proposal for a new nth\last\first\-child selector respecting order

CyberAP has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-selectors] Proposal for a new nth\last\first\-child selector respecting order ==
It would be nice to have an nth-child selector that respects order of the elements changed with an `order` property. It could be named like `nth-order` or `nth-by-order`.

Usage example:

```html
<div class="container">
  <div class="element first">1</div>
  <div class="element second">2</div>
  <div class="element third">3</div>
</div>
```
```css
.container
{
  display: flex;
  flex-direction: column;
}
.element.third
{
  order: -1; /* Now it's the first element */
}
.element:not(:nth-last-order)
{
  margin-bottom: 20px; /* Actual last element doesn't have margin */
}
```

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3086 using your GitHub account

Received on Friday, 7 September 2018 02:53:25 UTC