Writing hidden element rules

This article describes how to write hidden element rules in XBrowser, you can still use ABP rule syntax to write hidden element rules, the following describes how to write hidden element rules and examples.

The hidden element rule is also simple to write, it just starts with “##” as the hidden element rule identifier followed by the CSS selector syntax, we assume you already know the basic syntax of CSS selectors, here are some examples of hidden element rules.

Quick Start

Example 1


Hide the element with the element ID “ad-banner” in the page

Example 2


Hide all links in the page with the target address ‘https://www.example.com’

Example 3


Hide all page elements with class name “ad-container”


Hide DIV elements that have the attribute “title” and contain the string “ad” in the value of the attribute on the page

Adding domain scopes

The above examples are all globally effective hidden element rules, in order to make the rules more precise and reduce the accidental kill we can limit the scope of the rules to be executed only under a specific domain name. Here is an example of how to write a rule with a domain scope

Example 1


Hide the element with the ID “ad-banner” only on sites with the secondary domain “example.com”.


Equivalent ABP rule syntax

Example 2


Multiple domains separated by commas


Equivalent ABP rule syntax

Performance recommendations

It is strongly recommended to add the domain scope qualification when writing the hidden element rule, not only to prevent misuse, but more importantly, the performance will be better with the domain qualification, the rule will be executed only under the domain name that can be matched, which can avoid unnecessary performance consumption.

When writing rules for hidden elements, we should prioritize the use of ID and class selectors. ID selectors have the best performance and can quickly locate page elements. Here is a theoretical ranking of CSS selector performance, when using selectors please give preference to the high performance selectors.

  1. ID Selector(#myid)
  2. Clsss Selector(.myclassname)
  3. Tag Selector(div,h1,p)
  4. Adjacent Selector(div(h1+p)
  5. Child Selector(ul > li)
  6. Descendant Selector(li a)
  7. Wildcards Selector(*)
  8. Attribute Selector(a[rel=”external”])
  9. Pseudo Selector(a:hover,li:nth-child)