Set max height of Adsense responsive ad unit

user3275551 picture user3275551 · Oct 13, 2014 · Viewed 31.1k times · Source

I had 2 x (300x250) Adsense ad units in the right side bar of my site

I have made the site responsive and replaced these ad units with Adsense responsive ad units.

The problem i now have is that Adsense is now serving 2 x (300x600) ad units. Adsense TOS state that you can only serve 1 (300x600) ad unit per page

The max width is obviously getting picked up by adsense responsive ad units.

But when I try and set the max-height of the parent div to 250px, to limit the number of 300x600 ads per page, the max-height gets ignored and adsense still displays a 300x600

Has anyone else encountered this problem and if so, how did you manage to set the max-height of the responsive ad unit?

Thanks in advance,

Kes

Answer

galeksic picture galeksic · Oct 13, 2014

You could change data-ad-format="auto" to data-ad-format="rectangle". (See Advanced features > Horizontal shape example.)

I think you should not define height (max-height) on parent div.

Ad height is (automatically) determined by adsbygoogle.js (that is smart sizing