JSFiddle - React, Tailwind, and code Playground
HTML
<div class="some-class">
<div>
<p>The background of this should be red.</p>
</div>
</div>
<div class="some-class">
<div>
<p>The background of this should be blue.</p>
</div>
<div>
<p>The background of this should be blue</p>
</div>
</div>
CSS
.some-class div:only-child
{
background: red;
}
.some-class div:not(:only-of-type)
{
background: blue;
}