将横幅展示 Adsense
Putting Banner Behing Adsense
我目前正在为我的网站设置 adsense,并尝试在广告后面设置一个背景图片,这样如果有人访问带有广告拦截的页面,就会有一张图片礼貌地要求他们打开它如果他们愿意支持该网站。目前,我已将 adsense 代码包装在 div 中并在其上设置背景图像,但是当我这样做时,我的 adblock 软件能够检测到它并阻止它后面的图像。谁能告诉我这样做是正确的吗?干杯
HTML -
<div class="ad-alert">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Listings Banner -->
<ins class="adsbygoogle" style="display:inline-block;width:728px;height:90px" data-ad-client="ca-pub-9407013200292589" data-ad-slot="7535806952"></ins>
<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>
</div>
CSS -
.ad-alert {
width: 728px;
height: 90px;
background-image: url("../images/ad-alert-banner.png");
}
好的,自己解决了。诀窍是通过 CSS 设置 div 背景颜色,然后设置一个 background-image ,其中包含您想要的透明背景文本。下面是一个例子。
CSS -
.ad-alert {
width: 728px;
height: 90px;
background: #cccccc;
background-image: url("../images/randompeople.png");
margin: auto;
margin-top: 30px;
}
我目前正在为我的网站设置 adsense,并尝试在广告后面设置一个背景图片,这样如果有人访问带有广告拦截的页面,就会有一张图片礼貌地要求他们打开它如果他们愿意支持该网站。目前,我已将 adsense 代码包装在 div 中并在其上设置背景图像,但是当我这样做时,我的 adblock 软件能够检测到它并阻止它后面的图像。谁能告诉我这样做是正确的吗?干杯
HTML -
<div class="ad-alert">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Listings Banner -->
<ins class="adsbygoogle" style="display:inline-block;width:728px;height:90px" data-ad-client="ca-pub-9407013200292589" data-ad-slot="7535806952"></ins>
<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>
</div>
CSS -
.ad-alert {
width: 728px;
height: 90px;
background-image: url("../images/ad-alert-banner.png");
}
好的,自己解决了。诀窍是通过 CSS 设置 div 背景颜色,然后设置一个 background-image ,其中包含您想要的透明背景文本。下面是一个例子。
CSS -
.ad-alert {
width: 728px;
height: 90px;
background: #cccccc;
background-image: url("../images/randompeople.png");
margin: auto;
margin-top: 30px;
}