so I'm learning tailwind CSS but when I arrived at variants I got stuck
so when I use first: and last: only first works and it gets applied to all my list elements, it is supposed to work only to the first one, its the same for even and odd, please help me out
<ol class=" first:bg-green-500 last:bg-black">
<li>Lorem ipsum dolor sit amet.</li>
<li>Lorem ipsum dolor sit amet.</li>
<li>Lorem ipsum dolor sit amet.</li>
<li>Lorem ipsum dolor sit amet.</li>
<li>Lorem ipsum dolor sit amet.</li>
<li>Lorem ipsum dolor sit amet.</li>
</ol>
This classes should be applied on child elements, not parent
DEMO
In case you HAVE control over every element it is better to change style on exact element
This utility class is very useful when working with loops. For example