Responsive AdSense ads not displayed with Left, Right or Center alignment
-
The last version of Ad Inserter 2.0.13 introduced new CSS code for Left, Center and Right alignment. If you are using responsive AdSense code without specifying size (width) the AdSense code may not show ad block or ads. This is because the AdSense code can not determine container width (parent container has no width set).
There are two possible solutions for this:
1. Specify ad sizes (widths) for responsive AdSense ads. Media queries can be used for this purpose.
https://support.google.com/adsense/answer/3213689?hl=en
https://support.google.com/adsense/answer/6307124?hl=enCode example:
<style> .example_responsive_1 { width: 320px; height: 100px; } @media(min-width: 500px) { .example_responsive_1 { width: 468px; height: 60px; } } @media(min-width: 800px) { .example_responsive_1 { width: 728px; height: 90px; } } </style> <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <!-- example_responsive_1 --> <ins class="adsbygoogle example_responsive_1" style="display:inline-block" data-ad-client="ca-pub-XXXXXXX11XXX9" data-ad-slot="8XXXXX1"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>
2. Use custom CSS code for wrapping divs:
LEFT
text-align: left; margin: 8px 0px;
RIGHT
text-align: right; margin: 8px 0px;
CENTER
text-align: center; margin: 8px auto;
- The topic ‘Responsive AdSense ads not displayed with Left, Right or Center alignment’ is closed to new replies.