简体   繁体   English

CSS Google广告定位

[英]CSS Google Ad positioning

I'm having a problem with displaying my Google ad on www.FreeMinecraftHost.com 我在www.FreeMinecraftHost.com上显示我的Google广告时遇到问题

When I use this code: 当我使用此代码时:

<div class="top-bar">
        <div class="logo">
            <a href=""><img src="FMHLogo.png" alt="Logo" border=0></a>
            <div style="top:-25;"></div>
            <script type="text/javascript">
                <!--
                google_ad_client ="ca-pub-3955111504945324";
                /* Banner */
                google_ad_slot = "6834015980";
                google_ad_width = 468;
                google_ad_height = 60;
                //-->
            </script>
            <script type="text/javascript"
            src="https://pagead2.googlesyndication.com/pagead/show_ads.js"></script></div>
        </div>

    </div>

It breaks the top-bar div, and the ad goes underneath the logo, If I take out the 它会打破顶部栏的div,并且广告位于徽标下方,如果我将

<div style="top:-25;"> 

then the ad is next to the logo, but pinned to the bottom of the top-bar div, any ideas? 那么广告就在徽标旁边,但是固定在顶部栏div的底部,有什么想法吗?

Put the advert in its own div and change its z-index . 将广告放入自己的div并更改其z-index You could set it to some high value like 1000 or set it programmatically in case your page ends up with a lot of elements in the future. 您可以将其设置为较高的值(例如1000),也可以通过编程方式将其设置为将来您的页面包含很多元素的情况。 Eg: 例如:

div.google
{
    z-index: 1000; /*or do this programmatically with jQuery*/
    /*Other properties if required*/
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM