Page 1 of 1

Filtering parent elements by finding their children.

Posted: Thu May 24, 2012 11:27 pm
by WithMetta

Code: Select all

<div>
   <a href="adspam.com"> <--- What I use to find the ad
   <p>Crap text I don't want to see</p>
</div>
Anyway I could hide the parent div?

Re: Filtering parent elements by finding their children.

Posted: Fri May 25, 2012 12:13 am
by mapx
if your site is example.com, try:

example.com##a[href*="adspam.com"]

Re: Filtering parent elements by finding their children.

Posted: Fri May 25, 2012 10:33 pm
by lewisje
^That's not what the OP wanted exactly...

Anyway, you can't do what you're asking about until the following CSS4 feature is implemented: http://www.w3.org/TR/selectors4/#subject
Once it is, you can use something like example.com##$div>a[href*="adspam.com"] where the $ indicates the element to actually apply the CSS to.

In the meantime, you can use mapx's rule along with the following: example.com##a[href*="adspam.com"]+p
This rule hides all p elements adjacent to a elements with href containing "adspam.com"; mapx's rule hides those a elements.

Re: Filtering parent elements by finding their children.

Posted: Wed Oct 22, 2014 5:21 pm
by Zlatin Zlatev
If all your other divs on page have class or id, you could filter them out like

Code: Select all

div:not([class]):not([id])
It is not quite you want, but this worked for me in one particular overlay div case

Re: Filtering parent elements by finding their children.

Posted: Fri Dec 16, 2016 1:59 pm
by myname
how do i block this whole element when there is "PROMO" as marked on the picture
Image

Re: Filtering parent elements by finding their children.

Posted: Fri Dec 16, 2016 2:16 pm
by mapx
you cannot do it, work in progress ..