This is AdBlock's old support site. It is available for archival purposes only. To create a new discussion, or to visit the up-to-date knowledge base, please visit

correct filter syntax

Andre's Avatar


15 Sep, 2014 06:18 PM

Hi all together.

I'd like to ask which syntax for writing my own filters ist the right one or better to say the most efficient one?

For example: The Source code of:
<div class="textad">Advertising</div> requires the following filter … in that kind of case an element hiding.
##div.textad or ##div[class="textad"]

OR for another example

<div id="sponsorad"> requires an element hiding ##div#sponsorad or ##DIV[id="sponsorad"]

obviously is . and # just a masking for "id or class" containers in html source code. So fare so good, but what is better to use in adblock? Does it really matters which kind of syntax is written?

  1. Andre closed this discussion on 15 Sep, 2014 06:18 PM.

  2. Andre re-opened this discussion on 15 Sep, 2014 06:19 PM

  3. Support Staff 1 Posted by Brent on 29 Sep, 2014 04:49 PM

    Brent's Avatar


    For hiding rules, AdBlock injects a large CSS style sheet into each web page that sets the CSS display and visibility properties on all of the matching content to none and hidden. So your question then becomes which is the most efficient way for browsers to match CSS entries - by class or by id. I didn't find much regarding browser performance of CSS matching by class or by id. But, there maybe a couple of other things to consider.

    Classes are not unique, but Ids typically are. Therefore, if you want to be more general, and match a wider number of elements, use classes. Or, if you want to more specific, and only match a specific element, ids are generally preferred.

  4. 2 Posted by Andre on 29 Sep, 2014 05:26 PM

    Andre's Avatar

    Ah OK… Thanks. … :-)
    That helps a lot.

  5. Neelfyn closed this discussion on 09 Oct, 2014 08:37 PM.

Discussions are closed to public comments.
If you need help with AdBlock please start a new discussion.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac