[&:not(:first-child)] not working
#11327
-
|
Can anyone tell me why <div class="[&:not(:first-child)]:bg-red-500">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div> |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
|
Seems to be working fine, the effect can be seen when adding another copy: https://play.tailwindcss.com/wGwx8KxIvA. If it does not work in your project, consider checking:
|
Beta Was this translation helpful? Give feedback.
-
|
Not work at all. |
Beta Was this translation helpful? Give feedback.
-
|
this is working, but the div is only one, so it will not applied to the div (https://play.tailwindcss.com/tbY72Pzc4j) <div class="[&:not(:first-child)]:bg-red-500">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div>while this will make the second list of 1..4 having a red background as expected in https://play.tailwindcss.com/wGwx8KxIvA <div class="[&:not(:first-child)]:bg-red-500">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div>
<div class="[&:not(:first-child)]:bg-red-500">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div>it is the same as having the class what you (and me) actually want to achieve is this: <div class="[&>:not(:first-child)]:bg-red-500">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div>or this: <div class="*:not-first:bg-red-500">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div> |
Beta Was this translation helpful? Give feedback.
Seems to be working fine, the effect can be seen when adding another copy: https://play.tailwindcss.com/wGwx8KxIvA. If it does not work in your project, consider checking:
contentfile globs sufficiently cover the file that the code appears in.