Cannot find a responsive size for a container of width=0px and data-ad-format=auto adsense

£可爱£侵袭症+ 提交于 2019-12-12 12:12:30

问题


I'm trying to add an adsense responsive ad in a mobile site but I'm receiving the following error:

Cannot find a responsive size for a container of width=0px and data-ad-format=auto

The site is a mobile site built using JQuery Mobile 1.3. I set a width to the banner div container. I want to add the banner inside a ul:

<li>
    <div style="width: 100%">[Banner]</div>
</li>

I added a similar banner into another view and it works perfectly. Has someone had this problem? Thanks.

[EDIT] Well, if someone has this error, the solution that I found was change the adsense ad code, and modify the style manually, like the following code:

<style>
 .banner { width: 300px; height: 250px; }
 @media(min-width: 360px) { .banner { width: 336px; height: 280px; } }
 @media(min-width: 500px) { .banner { width: 468px; height: 60px; } }
 @media(min-width: 800px) { .banner { width: 728px; height: 90px; } }
</style>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- banner -->
<ins class="adsbygoogle banner"
     style="display:inline-block"
     data-ad-client="xxxx"
     data-ad-slot="xxxx"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>'

Thanks.

来源:https://stackoverflow.com/questions/25810361/cannot-find-a-responsive-size-for-a-container-of-width-0px-and-data-ad-format-au

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!