Given an arbitrary number of flexbox children with the built-in order attribute used for sorting, how do I select the last ordered element in CSS?
<ul style="display:flex"> <li style="order: 4">a</li> <li style="order: 5">b</li> <li style="order: 3">c</li> <li style="order: 1">d</li> <li style="order: 2">e</li> </ul>
:last-of-type does not work with flexible children, and the list can be of any length, so selecting by order index is not an option. I'm not interested in JavaScript solutions.
source share