Smart Ad Blocking using CSS · Tuesday February 24, 2009

I’ve been using Joe Francis’ userContent.css technique for Ad Blocking using CSS for years and have enjoyed nearly ad-free web surfing for years.

Combine this with ClickToFlash, a WebKit plug-in that prevents automatic loading of Adobe Flash content, and the web is once again a pleasant browsing experience.

I’ve been fortunate to encounter only a few false positives with the stock userContent.css, but wanted to share them here for others:


a:link[href*="/admin"] img,
a:link[href*=".a"] img {
	display: inline !important;
	}

The first line is an override for Shopify’s assets editor and the following line is a broad rule to show uploaded images on Typepad sites.

If you’re also a NetNewsWire user, take special note since it can be configured to use Safari’s style sheet selection, so if you’re having problems viewing images in feeds you should temporarily disable userContent.css or switch your theme to determine the actual cause of the problem.

I added this block of code at the end of my userContent.css file so that my customizations would remain separate from the core file, allowing painless future updates. Enjoy!

— Ryan J. Bonnell

---