[resolved] Problem Centering Ad with CSS (3 posts)

  1. covermesongs
    Posted 5 years ago #

    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.)

  2. stvwlf
    Posted 5 years ago #

    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

  3. covermesongs
    Posted 5 years ago #

    Thanks so much s! Worked perfectly.

Topic Closed

This topic has been closed to new replies.

About this Topic