Created
February 14, 2025 10:11
-
-
Save simeydotme/11fb2c3bd664c0bb1f153454ce353e6f to your computer and use it in GitHub Desktop.
tailwind selector for the last element in a container (if the # if elements in the container is odd)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ul class="[&>*:nth-last-child(2)_~_:nth-of-type(odd)]:text-red-500"> | |
<li /> | |
<li /> | |
<li /> | |
<li /> | |
<li /> <!-- red --> | |
</ul> | |
<ul class="[&>*:nth-last-child(2)_~_:nth-of-type(odd)]:text-red-500"> | |
<li /> | |
<li /> <!-- not red --> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment