XF 2.2 Alignment problem with Google Adsense in narrow format

Bonsai Coder

Active member
I have a tricky little problem that I am certain someone will have an easy fix for, but I can't figure it out.

I have my forum set up for narrow, medium and wide screen formats. All my Xenforo content aligns perfectly for all three widths. However I have a problem with Google Adsense ads - in the narrow and ONLY the narrow format. For some reason that I can't figure out, there is an additional margin that is added to the left of the ad that causes the ad to not display properly. In other words, the ad should be left aligned, and should fit perfectly, but instead the additional margin causes the ad to overflow the screen when you view the site on cell phones.

You can see the problem in this image. Note that even though this is the front page of the site, the format problem is consistent on forum pages, and ads that appear above and below the forum content.

Any help?

I am simply using the "Advertising" menu under "Setup" to insert the following code from Google:

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- BNUT Responsive Ad Top -->
<ins class="adsbygoogle"
(adsbygoogle = window.adsbygoogle || []).push({});

I have spent time playing around with PAGE formatting - for the page width breaks for responsive formatting for screens with different widths. However nothing I do removes that margin in narrow formatting.

I have also tried removed the <center> from the code above... or even left aligning... but nothing seems to work seamlessly.
Last edited:
Top Bottom