我创建了此AdSense广告并使用了位置:相对于放置它。我只需要将此广告展示在桌面上,而不是手机上。然而,此时广告也在移动设备上显示,并且由于我使用了“位置:相对”,因此将其展示在边界之外。如何才能在桌面上展示此广告并将其隐藏在手机上?谢谢。仅在台式机上显示AdSense广告并将其隐藏在手机上
<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>
我添加了一个例子,让我知道如果有帮助。 – Garry