Open this example in the interactive library
Source code
<div class="demo [&>:nth-child(odd)]:bg-teal-100">
<span class="tile">One</span><span class="tile">Two</span
><span class="tile">Three</span>
</div>
Alternate background colours in a list with Tailwind CSS 4 utilities. The preview uses precompiled styles.
Open this example in the interactive library
<div class="demo [&>:nth-child(odd)]:bg-teal-100">
<span class="tile">One</span><span class="tile">Two</span
><span class="tile">Three</span>
</div>