Open this example in the interactive library
Source code
<div class="demo [&>:only-child]:bg-cyan-100">
<span class="tile">Only child</span>
</div>
Style exactly one child with Tailwind CSS 4 utilities. The preview uses precompiled styles.
Open this example in the interactive library
<div class="demo [&>:only-child]:bg-cyan-100">
<span class="tile">Only child</span>
</div>