html - Google ad cannot find a responsive size in non-fixed width div -


i having issues getting adsense ad appear in non-fixed width div. basically, have 2 divs sitting side side, have google ad appear in second one, doesn't have fixed width set. see sample code:

<div style="width:1000px">  <div style="float:left; width:200px"> test </div>  <div style="float:right; overflow:hidden"> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle"  style="display:block"  data-ad-client="ca-pub-1234"  data-ad-slot="5678"  data-ad-format="auto"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div>  </div> 

google refuses serve ad, however, instead following error: "cannot find responsive size container of width=0px"

any ideas how can solved? thanks!

i ended using solution:

cannot find responsive size container of width=0px , data-ad-format=auto adsense

...which thought workaround, appears feeding google actual widths (only) way it.

from source (google): if place responsive ad code within parent container doesn’t have explicit width set, example, within floating element, our ad code won’t able calculate required size responsive ad unit. in case, you’ll need modify code , use css media queries set size of parent container.

ps: center ad properly, if you're using linked-to solution, put "margin:auto" in .banner class.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -