Support » Themes and Templates » [Resolved] Problem Centering Ad with CSS

[Resolved] Problem Centering Ad with CSS

  • I’m having a problem centering the ad above my page (http://www.covermesongs.com). It’s a rotating ad controlled by an external ad service. Whenever the ad displayed comes in Javascript or HTML format, it centers fine. If the ad is a jpg or gif file though, it remains left-aligned. This means half the time the ad is centered and half the time it isn’t. Refresh the page a few times and you’ll see what I mean.

    I’ve been trying to figure this out in the CSS code I use to control the ad, but have come up nothing. Here’s what I’m using:

    .banner-ad {

    Does anyone have any idea what the problem is, why this is centering Javascript and HTML ads but not image ads? Thanks so much!

    (If it matters, I’m hosting the site on Bluehost and using the Suffusion template.)

Viewing 2 replies - 1 through 2 (of 2 total)
  • Before the place in the code that displays the ads I found this line in the browser’s View Source

    <div style="width: 728px; height: 90px; border-width: 0px;">

    When I changed it to this (in FireBug) the ad that had been left justified was displayed centered.
    <div style="width: 728px; height: 90px; border-width: 0px; margin: 0 auto;">

    It looks like you need to add it in the PHP file, not to the stylesheet as the styles seem to be hard coded into the PHP template file. Normally the code would be in the theme’s header.php file although the more involved themes sometimes put it in a subfile.

    Give it a try

    Thanks so much s! Worked perfectly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Problem Centering Ad with CSS’ is closed to new replies.
Skip to toolbar