我目前正在试用谷歌广告,这些广告效果很好,但当屏幕大小超过一个特定大小时,是否有办法显示两个广告呢?
例如,当屏幕大小大于620像素时,显示两个"250 x 250“广告(而不是仅仅一个)。
发布于 2014-09-29 08:05:50
您可能不会放置两个广告(没有一些服务器端编码,这可能会导致各种问题),但您可以增加或缩小广告的大小,以实现类似的行为使用媒体查询。例如:你可以展示-
为此,您需要在“响应广告”中使用高级代码(所需的代码修改)如下:
<style>
.responsive2 { width: 300px; height: 250px; }
@media(min-width: 500px) { .responsive2 { width: 336px; height: 280px; } }
@media(min-width: 800px) { .responsive2 { width: 728px; height: 90px; } }
@media(min-width: 1200px) { .responsive2 { width: 970px; height: 250px; } }
</style>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Responsive2 -->
<ins class="adsbygoogle responsive2"
style="display:inline-block"
data-ad-client="ca-pub-XXXXX"
data-ad-slot="YYYYY"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>有关高级响应adsense广告的详细信息,请参阅https://support.google.com/adsense/answer/3543893#adv
https://stackoverflow.com/questions/18663665
复制相似问题