Set max-height of Google responsive ad units on mobile devices

Viewed 390

I have tried several ways to limit the max-height of Google's responsive ad units.

I have tried setting height and max-height on the containing div and on the ins tag.

I have also tried setting data-ad-format="horizontal" instead of the default value "auto".

<div style="height: 60px; max-height: 60px">
    <!-- Responsive center ad -->
    <ins class="adsbygoogle"
         style="height: 60px; max-height: 60px;"
         data-ad-client="ca-pub-xxx"
         data-ad-slot="xxx"
         data-ad-format="horizontal"
         data-full-width-responsive="true"></ins>
    <script>
        (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
</div>

None of these methods have any effect, the result is always a 300x250 pixels ad on mobile devices.

What do I do wrong? Are there separate settings for mobile devices? This all works on desktop, but I am not able to limit the height of ads on mobile.

0 Answers
Related