
Tell HN: Adsense started altering the pages it is on - FreeHugs
Some days ago, my pages where I have Google Adsense on were suddenly completely broken.<p>After some investigation, it turned out that the Google Adsense code started to change the styles of the page it is on.<p>It seems it figures out which parent element or grand-parent or grand-grand-parent... element is limiting its height. And then adds &quot;height: auto !important&quot; to that element.<p>If it is limited by max-height, it adds &quot;max-height: auto !important&quot; to the limiting element.<p>I had Googles dynamic ad sizes in a div with a size that fits my layout. Since they adapt to the space they get, everything was fine. But now they <i>explode</i> their parent element to a size that breaks my site.<p>I find this behavior pretty shocking.
======
aloknnikhil
Are you by any chance placing these ads in-feed? They do call this out. It's
definitely odd that they're doing this.

[https://support.google.com/adsense/answer/9189959?hl=en](https://support.google.com/adsense/answer/9189959?hl=en)

~~~
FreeHugs
I am not using the in-feed ads, but the responsive ads.

No matter which ads - I think it is not acceptable that they alter the
surrounding page. They also don't state that on the page you linked. What they
talk about there is about the size of the ad. But what the ad code does now is
to analyze the rest of the page and alter it.

------
zzo38computer
Can you put the ad into a iframe?

~~~
buboard
Nope. Adsense scripts enforce height=auto!important on the parent elements of
wherever it is placed, and often render an iframe with dimensions exceeding
the widths of the container. Their responsive ads are also huuuge now, like
970x600

