JSFiddle - React, Tailwind, and code Playground

HTML

<div>
<p class="test">The first paragraph.</p>
<p class="test">The second paragraph.</p>
<p class="test">The third paragraph.</p>
<p class="test">The fourth paragraph.</p>

<p class="test"><b>Note:</b> Internet Explorer 8 and earlier versions do not support the :nth-last-child() selector.</p>
<p>
another P here...
</p>
</div>

CSS

div p.test:not(:last-of-type) {
    background: red;
}