Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
CyberAP opened this issue Sep 7, 2018 · 1 comment

Comments

@CyberAP
Copy link

CyberAP commented Sep 7, 2018

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:

<div class="container">
  <div class="element first">1</div>
  <div class="element second">2</div>
  <div class="element third">3</div>
</div>
.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 */
}
@tabatkins
Copy link
Member

Unfortunately, this idea falls into the general category of impossible things that we have to automatically reject: https://wiki.csswg.org/faq#selectors-that-depend-on-layout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants