问题
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