JSFiddle - React, Tailwind, and code Playground

by Gabriele Petrioli

HTML

<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>
<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 {
    background-color: red;
}
.some-class div + div, .some-class div:nth-last-child(2) {
    background-color: blue;
}