Support » Fixing WordPress » How do I wrap my ad code in a div class or id?

  • Hello there,

    I have added my first google advertisement on my website but I have a little problem: the ad is slightly truncated with the navigation bar. How can I align from top to bottom the ad block? (I’d like to align it with the logo)

    I am currently using an ad block of w=728 h=90 and it’s placed at top part of the website, next to the logo. Here is the link of my website:


Viewing 9 replies - 1 through 9 (of 9 total)
  • Michael


    Forum Moderator


    <div class="header-ad">

    Unfortunatelly is not working. I still see the ad truncated, moreover I have tried to follow the instructions as reported here but it is not working too.

    However here I write the steps that I have done:

    I have sourrounded the google code with: <div id=”adsenseAd”>…google code…</div> ;

    Then added in the style.css: #adsenseAd { margin-left: bottom; } ;

    It didn’t work and I have tried another possible solution in header.php but it didn’t work too:

    <div style=”text-align: center;”>…google ad code…</div>

    Any idea what it could be?



    Forum Moderator

    I don’t see any truncation;

    to push the ad down, try:

    #adsenseAd { padding-top: 50px; }

    adjust the number value.

    posting a screenshot of your problem might help to illustrate what you are getting in your browser.

    Hi alchymyth,

    The ad block is not moving at all. I have tried different solutions but it remains as it is now. This is what I’ve done so far is (text in bold is the new code lines added):

    header.php page:

    <div id=”adsenseAd”><script type=”text/javascript”><!–
    google_ad_client = “ca-pub-6085820096448112”;
    /* nonhoTVtop */
    google_ad_slot = “0253151975”;
    google_ad_width = 728;
    google_ad_height = 90;
    <script type=”text/javascript”

    After having added <div id=”adsenseAd”> I’ve opened the CSS Stylesheet page and added at the botton of the CSS:

    #adsenseAd {
    padding-top: 50px;

    Regarding the screenshot, I think there is no need to uploadit as I just want to push the ad down like you have said.




    Forum Moderator

    try to clear the browser cache – ‘CTRL F5’ or ‘reload’ or whatever your browser needs…

    I can’t find the #adsenseAd css in your site.

    Hi alchymyth,

    I have tried to clear the browser cache but there are no changes.

    Regarding #adsenseAd I have added it in Stylesheet (style.css) at the bottom of my theme’s stylesheet (style.css). This is where I have added the value:

    [CSS code moderated – a link to your site is enough to access the styles]

    This is the very end of my stylesheet, I have also notice that there is another page called Style-black.css (style-black.css), perhaps I should make some changes there?

    Moreover I have copied the google ad code in the header page (header.php) just below the following code string:

    [code moderated – the forum limit is 10 lines – please follow the forum guidelines for posting code]

    Did I do something wrong?




    Forum Moderator

    that section at the end is only called for smaller screens;

    add the css somewhere close to the top of style.css

    Hi alchymyth,

    My mistake was adding the value at the end of my stylesheet as you have pointed out. Moving the CSS value from the bottom to the top (headings section) it worked!

    Thanks a million!

    Issue fixed.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How do I wrap my ad code in a div class or id?’ is closed to new replies.