gpt4 book ai didi

adsense - 如何防止 320x100 像素的大型移动横幅有时会调整为 320x50 像素的移动排行榜?

转载 作者:行者123 更新时间:2023-12-04 16:15:58 25 4
gpt4 key购买 nike

我使用的是自适应广告单元,并将广告单元尺寸设置为 320x100,但有时会显示 320x50 的广告,并且在广告下方留下了一个难看的空间。我曾尝试将广告单元强制为 320x50,但它们始终将大小调整为 320x100。我可以做些什么来防止广告下方出现此空间?

enter image description here

使用的代码:

HTML:

<aside class="advertisement">
<ins class="adsbygoogle horizontal-ad"
data-ad-client="ca-pub-000000000"
data-ad-slot="0000000"
data-ad-format="horizontal">
</ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</aside>

CSS:
.advertisement {
display: flex;
justify-content: center;
box-sizing: border-box;
margin: 0;
overflow: hidden;
}

.horizontal-ad {
display: block;
width: 320px;
height: 100px;
}

最佳答案

试试 min-height在您的 .advertisement类(class)。请看下面的例子

.advertisement {
display: flex;
justify-content: center;
box-sizing: border-box;
margin: 0;
overflow: hidden;
background: yellow;
min-height: 50px;
}

.horizontal-ad {
display: block;
width: 320px;
height: 50px;
background: #777;
}
<aside class="advertisement">
<ins class="adsbygoogle horizontal-ad"
data-ad-client="ca-pub-000000000"
data-ad-slot="0000000"
data-ad-format="horizontal">
</ins>
</aside>

关于adsense - 如何防止 320x100 像素的大型移动横幅有时会调整为 320x50 像素的移动排行榜?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49312241/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com