I have following scenario and I can't figure out how to select all p
elements but not in div
with content
class:
<div class="content">
<p></p> <!-- not this one -->
<p></p> <!-- not this one -->
<div>
<p></p> <!-- not this one because this is also inside content -->
</div>
</div>
<div class="other">
<p></p> <!--this one -->
</div>
<p></p> <!--this one -->
So I just want to select all p
elements but not elements inside element with class="content"
.
More info:
I have application that content is dynamically generated. In this content there are some p
elements that I don't want to apply the styles.
Some brilliant developer add this kind of style in the beginning of the project:
p {
color: #333;
font-size: 12px!important;
line-height: 18px!important;
margin: 0!important;
}
So as You see this applies to all p
elements. My task is to fix only content
rendering so it will have different font-size etc... So I though I will change p selector to exclude those inside content
class. If I change this definition of p
css style then I can unintentionally change some other subpage so I don't want to mess with that because I just want to make it fast without going deep into the code and html created by this developer. The rest of the page is working fortunately very well but I don't know how to nail all those elements in content
class only and leaving the rest of p
elements as it was untouched.