uBlock is blocking an ad from some website, but it leaves the large (in height) div which expands the site after loading and pushes the main text down. Using "Block is element" gives me
###js-ad-container-XYZ
with XYZ being a random string as a selector and using this suggestion, the div gets removed, but appears again after going to another article on that site.
To wildcard the random number, I found this blog post which suggests to use www.annoyingwebsite.com##div[id^="start_of_div_name_before__randomnumber"]
and so I tried to alter the rule to
that-site.com##div[id^="js-ad-container"]
but that doesn't seem to work as the filter editor shows an error in the line and the huge div is still on the site clicking preview in the filters editor. I also tried to use three ###
before div but that didn't help either. I guess this is a simple thing that should work so I expect that I am doing it wrong...
Edit: I checked with inspector, that the element is really a div with the id as it appears in the editor at using "Block element" from the context menu.
#js-ad-container-XYZ
means you want to block the element with the id of js-ad-container-XYZ
. With your second attempt you say to only block the div
node(s) with that id. This will either do the same, worse case it would not match any nodes. I found you usually need to go expand the block to any number of parent nodes till you block the relevant container. For that you use the nth-ancestor()
:
that-site.com##div[id^="js-ad-container"]:nth-ancestor(1)