我目前正在试用 Google Adsense 响应式广告,效果很好,但是当屏幕尺寸超过特定尺寸时,有没有办法显示两个广告?
例如,当屏幕尺寸大于 620 像素时,将两个“250 x 250”的广告并排展示(而不是一个)?
最佳答案
您可能不会放置两个广告(没有一些可能会导致各种问题的服务器端编码),但您可以增加或减少广告的大小以使用媒体查询实现类似的行为。例如:您可以显示 -
为此,您需要在“响应式广告”中使用高级代码(需要修改代码),如下所示 -
<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
关于responsive-design - Google Adsense 响应式广告 - 为更大的屏幕使用两个广告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18663665/