JSFiddle - React, Tailwind, and code Playground

by Varinder

HTML

<div class='container'>
    <p>Zero</p>
    <p class="red">First</p>
    <p class="red">Second</p>
    <p class="red">Second</p>
</div>

CSS

.container p + p.red {
    color: red;
}

.container p + p.red ~ p {
    color:black; /*reverting back*/
}

JavaScript

$(".container").children(".red").first().addClass("active");