TagError: adsbygoogle.push() error: No slot size for availableWidth=0\n
The reason for this problem is that the valid width of its parent container can't be detected.
in my case:
I used such a structure and css style and it prompts an error:
<div> // display:flex
<div class="text-container"></div>
<div class="sidebar">
<script>
// google ads
</script>
</div>
</div>
and css:
.sidebar{
max-width: 300px; // here is the problem
}
so, here, if we don't have any other elements in our sidebar
, then google adsense won't be able to know the width of our sidebar, and it will prompt the error.
if you can fill any other elements into the sidebar, then the max-width
will work normally.
if not, you'd better change max-width
to a fixed width
:
.sidebar{
width: 300px;
}
then is will show ads properly.