I redesigned the advertising page of my side project, LaunchShots (a free App Store screenshot maker). Tested it locally in light mode, dark mode and at phone width. Everything looked right. I uploaded it.
On the live site, the hero section was gone. So was the "who reads this site" block under it. The stats strip, the section below it and the footer were all there. Just two big holes at the top of the page.
The first clue: display: none from nowhere
I opened the console on the live page and checked the computed style of the missing hero:
getComputedStyle(document.querySelector('.ad-hero')).display // "none" Then I went through every stylesheet the page loads, looking for a rule that matched the element and set display: none:
const el = document.querySelector('.ad-hero'); for (const sheet of document.styleSheets) { let rules; try { rules = sheet.cssRules; } catch (e) { continue; } // cross-origin sheets for (const r of rules) { if (r.style?.display === 'none' && r.selectorText && el.matches(r.selectorText)) { console.log(r.selectorText); } } } // nothing Nothing. No rule on the page was hiding it. The display: none was coming from outside the page.
The cause: my own class names
It's an advertising page, so every class on it started with ad-: .ad-hero, .ad-box, .ad-price, .ad-stat...
Ad blockers don't only block ad requests. They also ship cosmetic filters: generic CSS rules that hide elements whose class names look like ad containers. They inject these into the page from the extension, which is why they don't show up in document.styleSheets. My ad blocker took one look at .ad-box and .ad-hero and decided they were ads.
Two details made this harder to spot:
- Not every
ad-class was hidden..ad-statsand.ad-aiwere fine. Only specific names matched the filter lists, so half the page worked and the other half didn't. That looks like a layout bug, not an ad blocker. - It worked on localhost. My blocker didn't touch the page on
127.0.0.1, so every local test passed. The bug only existed on the real domain.
The fix
I renamed every ad- class to a neutral prefix (lsk-, from the project name). Same CSS, same markup, nothing else changed.
Before uploading, I checked the new names against the ad blocker on the live domain itself, by creating a throwaway element for each class name and reading its computed style:
const names = ['lsk-hero', 'lsk-box', 'lsk-price', 'ad-box', 'ad-hero']; for (const name of names) { const el = document.createElement('div'); el.className = name; el.textContent = 'x'; document.body.append(el); await new Promise(r => requestAnimationFrame(r)); // let the blocker react console.log(name, getComputedStyle(el).display); el.remove(); } // lsk-* -> "block", ad-box / ad-hero -> "none" All 42 new class names came back visible. After the upload, a sweep for hidden elements inside the page's <main> came back empty:
[...document.querySelectorAll('main *')] .filter(el => getComputedStyle(el).display === 'none') .map(el => el.className); // [] What I'm taking from it
- Don't name classes or IDs like ad slots.
ad-*,ads-*,advert*,banner*,sponsor*are all risky, even on a page that is about advertising. Especially on a page about advertising. - Test the real domain with an ad blocker on. A lot of your visitors run one. Localhost, a staging IP or a clean browser profile can all give you a false pass.
- If something has
display: noneand no stylesheet on the page explains it, suspect an extension. Open the page in a private window with extensions off. If it shows up there, you have your answer.
The funny part: the page that broke is the one asking advertisers to pay for placements. I had built an ad page so convincing that the ad blocker agreed.
Disclosure: I build LaunchShots with Claude Code. Claude wrote the ad- class names in the first place, then helped me debug them and draft this post.


