CSS选择不遵循元素的元素

Ozz*_*zzy 4 css css-selectors

我想选择所有不遵循H3或P的P:

<img>

<p> this is selected</p>

<p> this is not</p>

<p> this is not</p>

<span>

<p> this is selected</p>

<h3>

<p> this is not</p>
Run Code Online (Sandbox Code Playgroud)

我试过了

p + :not(h3, p) and :not(h3, p) + p
Run Code Online (Sandbox Code Playgroud)

但他们不起作用

解决办法是什么?请帮忙

Nel*_*son 5

你可以这样表达css选择器:

*:not(h3):not(p) + p

看工作演示