JSFiddle - React, Tailwind, and code Playground
by infous
HTML
<div>
<span>This span is selected!</span>
<span>This span. :(</span>
<span>What about this?</span>
<span>And this one?</span>
<span>Another example</span>
<span>Yet another example</span>
<span>Aaaaand another</span>
</div>
CSS
/* First three items. (Red) */
span:nth-child(-n+3) {
background: #f00;
}
/* Last three items. (Green) */
span:nth-last-child(-n+3) {
background: #0f0;
}