What is the trick to getting the displayed ads to center themselves within the block? They come up fine, but only to the left of the block, and editting the CSS for the theme doesn't seem to work.

CommentFileSizeAuthor
#10 centeradsenseinjector.png309.71 KBfblevins

Comments

zach978’s picture

I second this, is there an easy way to do this?

yas’s picture

You can specify the position in a block in your css as follows:

.adsense {
  text-align: center;
}

or if you want to specify the position individually,

#block-adsense-1 {
  text-align: center;
}

#block-adsense-2 {
  text-align: left;
}

#block-adsense-3 {
  text-align: right;
}

...
Oceria’s picture

If you're not comfortable adding things to your css file you can use
<div align="center">[adsense ]</div> in the post itself.

deepesh’s picture

Another easy to implement way would be to use the Adsense Injector Module & use the template below under the "List ad insertion template: *" setting :
%teaser<div class="injected" style="text-align: center;">[adsense:468x60:1:1]</div>

jcnventura’s picture

Status: Active » Closed (fixed)

Just added some code to center the ads in the block.

João

tmancanada’s picture

I've just tried all of these suggestions, and all failed

bart3k’s picture

Same here. I don't understand how to do it. Help please....

bart3k’s picture

I want to be able to center the entire block, if you look at http://www.brawngpteam.com at the footer i need to center that block. Any way to do it?

jcnventura’s picture

Download the latest dev version, and you'll have an option to center the ad in the block.

fblevins’s picture

StatusFileSize
new309.71 KB

This is an old thread but I thought I'd throw my two cents in as I'd been looking for a way to do this and none of the methods I'd read in these forums worked (for me at least). So after walking away for a few hours and letting my mind settle I came back and did this:

1. Administer -> Site Configuration -> Adsense Injector -> Node body ad insertion template
2. Switch to source.
3. Enclose the adsense in center tags thus:

html center tag begin
#

[adsense:728x90:0123456789]

html center tag end

(forum strips the center tags I tried to insert above)

You'll come out with your ad showing above your node as in the screenshot I'm attaching. One strange consequence is that my banner ads on my front page (which is populated by panels containing mini-panels containing views) display centered also. That's ok because that's the way I wanted it anyway, but if I'm logged in as administrator I strangely do NOT get this side-effect. Go figure! Anyhow, it works so I'm not gonna jack with it anymore unless or until it breaks!!!

Yeah, it's a hack, but it works. Like we said in the Army... "If it looks stupid but it works, it ain't stupid!"