dev*_*ev9 2 html css adsense media-queries responsive-design
我在高级模式下使用自适应AdSense单元.它工作正常,直到我决定调整浏览器窗口的大小.广告未按媒体查询中的指定调整大小.
<style>
.myad { width: 320px; height: 50px; }
@media(min-width: 500px) { .myad { width: 468px; height: 60px; } }
@media(min-width: 800px) { .myad { width: 728px; height: 90px; } }
</style>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle myad"
style="display:inline-block"
data-ad-client="XXX"
data-ad-slot="XXX"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
Run Code Online (Sandbox Code Playgroud)
CSS是正确的.在Firebug中,我可以看到媒体规则划掉并取而代之的是:
element.style {
display: inline-block;
height: 90px;
width: 728px;
}
Run Code Online (Sandbox Code Playgroud)
您的自适应Google广告没有问题.
更改浏览器大小时,Google广告不会自动调整大小.如果您刷新浏览器,则Google Adsense会显示/投放尺寸与浏览器/页面当前大小相匹配的新广告.
我试图找到文件来验证我的陈述,但我找不到任何相关的东西.我的回答是基于我使用自适应Google广告并对其进行测试的经验.
| 归档时间: |
|
| 查看次数: |
2558 次 |
| 最近记录: |