JSFiddle - React, Tailwind, and code Playground
HTML
<div class="myDiv">
<div>
I want to be red.
</div>
</div>
<p>I'm some other content on the page</p>
<div class="myDiv">
<div>
I want to be blue.
</div>
</div>
CSS
.myDiv:nth-of-type(odd) div {
color: red;
}
.myDiv:nth-of-type(even) div {
color: blue;
}