Is there any way to select children without any parent of a specific class in CSS ? Let's say I have the following HTML code:
<div class="disable-common">
<div>
<p>Test 1</p>
</div>
</div>
<div class="disable-common">
<p>Test 2</p>
</div>
<div>
<p>Test 3</p>
</div>
I want to select all p
tags which are not children of a div with the disable-common
class.
I manage to do it for the "Test 2" only with the following selector: div:not(.disable-common) p
but unfortunately, the "Test 1" is not concerned by the selector because "Test 1" is nested in a div which didn't have the disable-common
class. So my question is: how can I specify in my selector that I want all p without any div
parent with the disable-common
class. I don't even know if such a selector is possible.
Edit: Here is a plunker: https://plnkr.co/edit/vzNKIDTfRhRyYfqlivc3?p=preview