【发布时间】:2015-06-27 19:08:48
【问题描述】:
我制作了这个 AdSense 广告并使用 position: relative 来放置它。我只需要在台式机而不是手机上展示此广告。然而,此时广告也在手机上显示,因为我使用了“位置:相对”,所以它显示在边界之外。关于如何在台式机上显示此广告并将其隐藏在手机上的任何想法?谢谢。
<div style="position: relative; left: 700px; top:-100; ">
<style>
.test-ad { width: 728px; height: 90px; }
@media(min-width: 500px) { .test-ad { display: none; } }
@media(min-width: 800px) { .test-ad { width: 728px; height: 90px; } }
</style>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- test-ad -->
<ins class="adsbygoogle test-ad"
style="display:inline-block"
data-ad-client="XXXXXXXXXX"
data-ad-slot="XXXXXXXXXXX"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
【问题讨论】:
-
我添加了一个示例,如果有帮助请告诉我。
标签: html css jquery-mobile mobile adsense