3

I need to use CSS to select all <p> elements except for the <p> that comes right before the div ID #one.

There will also be a varying number of <p> elements before #one so I won't be able to use nth-child.

<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<div id="one">div</div>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>

Ideally, I could do something like:

p:not(p+#one) {
    color: red;
}

Obviously, that doesn't work though.

user715564
  • 1,650
  • 2
  • 25
  • 60

0 Answers0