JSFiddle - React, Tailwind, and code Playground

HTML

<ul>
 <li></li>
 <li></li>
 <li></li>
 <li></li>
 <li></li>
 <li></li>
</ul>

CSS

ul li:nth-last-child(-n + 2) {
        color: orange;
    }