Skip to content

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

Closed
@CyberAP

Description

@CyberAP

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 */
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions