我創建了此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