Tuesday, June 19, 2012

How to Center Adsense Ads on Blogger

The concept applies to any blog.

The Directions

  1. Get on Blogger and click the "Template" tab.
  2. Click the button labeled "Edit HTML" and then click the "Proceed" button to reach the source code for your blog.
  3. At the top of your source code there will be a bar with a unchecked box that says "Expand Widget Templates". Check that box! You cannot find the code you need to alter without expanding the widget templates.
  4. With the "Expand Widget Templates" checked the source code below is even more in depth than it was before! (now it is showing additional code for widgets)

    Press Ctrl + F or manually open the Find module for your internet browser.
  5. In the Find moodule's text area, type adCode and press Enter to search the page for the Adsense code. It will look similar to the code below
    <b:if cond='data:blog.pageType != &quot;error_page&quot;'> <data:adCode/> </b:if> <b:include name='quickedit'/>
  6. Now insert <center> before and </center> after .
  7. Click the Preview button to make sure the change was made (and did not have any unwanted side effects). Click the Save template button and close your template if the preview passed inspection.
All we did was replace <data:adCode/> with <center><data:adCode/></center> which can be undone at any time in the template source code.


liloo said...

works like a charm, thank you so much xx

Brian said...

Glad you liked it! Any requests for a future post?

Nicole said...

THANK YOU! I've read through quite a few posts trying to solve this issue, but no one mentioned the 'Expand Widgets' checkbox. No wonder I could not locate the appropriate code. I am quite grateful for this post :)

P.S. if you're still looking for future post requests, I have two: 1) I would like to link my header title to my home page and 2) I want to widen my main content area slightly. Just throwing some serlf-serving ideas out there :)

Joanne said...

it worked for me! THANK YOU!

Kera said...

THANK YOU so much!! I've been trying to fix the alignment of my Adsense ads forever. Works perfectly!

Kane1 said...

It works. Thank you.

Brian said...

No problem!

Kevin Smith said...

Works ... Thank You!