When I used Adsense I could just add HTML to align the AD to be centered in a block, but when I use this module the ADs are displayed aligned to the left. How can I change this to make the ADs display aligned to the center of the block?

For example:

<div align="center">AD CODE</div>

Thanks in advance!

Comments

jcisio’s picture

Status: Active » Fixed

You can add this in your template css:

.gam-holder {
  margin: 0 auto;
}
HS’s picture

Super! Thanks for the quick reply. Will give it a go and report back.

StuddMan’s picture

Was having same issue, that tweak works perfect, thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

HS’s picture

This didn't work for me perhaps because the default alignment of the page is aligned to the left. So the AD slot is also aligned left of the block not centred. Any ideas folks?

HS’s picture

The following css code makes it look aligned centred. But not sure if thats the right way to go. Do you guys see anything wrong in using it?

.gam-holder {
margin-left:10%;
margin-right:10%;
}

HS’s picture

Status: Closed (fixed) » Active

OK. The above 10% margin alignment didn't work.

I have two block on the same page. One is a 728x90 on the top of the page and other 300x250 on the sidebar.

The sidebar 300x250 block displays correctly, and is centred when you use:

.gam-holder {
  margin: 0 auto;
}

But the 720x90 is aligned to the left.

If I add 10% to the margin from left and right, it throws the sidebar blocks off but aligns the 728x90 almost centred.

Can someone please help?

HS’s picture

There could be something in my theme's CSS that's throwing it off. Will investigate further and report back.

jcisio’s picture

All elements are provided with classes and ID. You have block (maybe with class "content") > .gam-holder > .gam-banner. You have the same liberty as you insert the GAM code manually.

HS’s picture

I understand that all individual slots have classes and IDs but customising every block individually with CSS to align the AD centred horizontally defeats the purpose, eh?

Does anyone know why margin: 0 auto; works on every block but one? There has to be something to it, yeah?

It is not my theme as I thought.

jcisio’s picture

Status: Active » Postponed (maintainer needs more info)

It looks like your own theming problem.

wemmies’s picture

I had a similar problem and did:

.gam-holder {
margin: 0 auto;
text-align: center;
}

This centered the add in my right column.

wemmies’s picture

damn proxy double post.

wemmies’s picture

proxy triple post sorry

jcisio’s picture

Status: Postponed (maintainer needs more info) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.