How to Center Adsense Widgets

Pin It

So if you're like me, you like things to be all nice and lined up.  I recently installed an Adsense Banner below my Pages and it was stuck on the left.  I had added it via the Page Elements Screen, as a basic widget and couldn't for the life of me figure out how to move it to the center rather than it hanging out on the left all out of alignment.  So I did some digging, and found the necessary code changes that needed to be made.

Start out on our favorite "Edit HTML" screen and don't forget to check the "Expand Widget Templates" box or you won't ever find this code!


Using "Ctrl + F" Search for this code:

<b:widget id='AdSense1' locked='false' title='' type='AdSense'>
<b:includable id='main'>
  <div class='widget-content'>
    <data:adCode/>
    <b:include name='quickedit'/>
  </div>
</b:includable>
</b:widget>

Do you see the line that I highlighted in red?  Replace it with this code:

<div align='center' class='widget-content'>

Go ahead and click "Save Template" and now your Adsense banner should be centered on the page!

11 comments:

  1. Thanks so much for this tip! I've tried like 10 different tips & yours was the easiest to understand and follow through on :o)

    ReplyDelete
  2. It took me so long to find someone who knew how to do this perfectly. I searched for 2 hours trying different suggestions and none of them worked. Luckily, I remembered that I had used your code previoulsy AND was smart enough to bookmark this page and of course it worked first time on my blog East Timor Legal News Archive - and ended all my frustration and wasted time trying to implement other's suggestions that were complete failures. Thanks ever so! This is a valuable page! And you are smart!

    ReplyDelete
    Replies
    1. I'm glad it worked for you! I'm working on getting more content on here but am behind!!! :) Make sure you follow the blog or my facebook page to stay tuned for updates!

      Delete
  3. Thanks a lot you made it so easy that anyone can do it.

    Thanks for your help!
    sesanopeola.blogspot.com

    ReplyDelete
  4. UnfortunAately it didn't work on my blog :(
    Help?

    Alina à la Mode

    ReplyDelete
  5. Thank you so much for that tip. It's been bugging me for weeks!

    ReplyDelete
  6. Thank you so much for that tip. It's been bugging me for weeks!

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...