JSFiddle - React, Tailwind, and code Playground
HTML
<header>
<div><small><b><div></b> element</small></div>
<p><small><b><p></b> element (<b>div + p</b> selects all <b><p></b> elements that are placed immediately after <b><div></b> elements)</small></p>
<p><small>Second <b><p></b> element</small></p>
<br/>
<h2>How can I select all <b><div></b> elements that are placed immediately BEFORE <b><p></b> elements?</h2>
</header>
CSS
*{margin:0;padding:0;}
div + p {color:red;}
p {color:blue;}
header{margin:20px 0 0 20px;}