JSFiddle - React, Tailwind, and code Playground

by LuckyCat

HTML

<p>Text</p><p><i>Text</i></p><p><b>Text</b></p>

CSS

p:contains-element(i) {
    color: red;
}

p:contains-element(|b) {
    color: green;
}