html - 如何删除 AdSense 广告下方的空白区域?

标签 html css responsive-design adsense

我在移动网页的顶部有一个 AdSense 自适应广告单元。当 320x50 的广告填充此空间时,广告底部会出现额外的空白区域。提供 320x100 广告时没有空白区域。我没有为 div 元素定义大小,因此该单位应根据 Google 提供的任何广告进行调整。

如果转换 320x50 而非 320x100 的广告,是否可以折叠空白区域?

我认为这是一个常见问题,但我一直未能找到解决方案。预先感谢您的帮助。

我认为 Google 最初尝试提供 320x100 单元,但最终提供了 320x50 单元,留下了额外的空白。根据 Google 的说法:“为了帮助增加 320x100 广告尺寸的竞争,我们允许 320x50 展示广告出现在这种格式中。发生这种情况时,较小的广告将始终在顶部垂直对齐。”

最佳答案

因此,由于广告已经在容器中,请尝试以下操作:

.ad-wrapper {
  width:320px;
  height:50px;
  overflow:hidden;
}

并在容器上添加 ad-wrapper 类。

<div class="ad-wrapper" align="center">
  <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
  <!-- Top_Responsive --><ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-xxxxxx" data-ad-slot="xxxxxxx" data-ad-format="auto"></ins>
  <script>
    (adsbygoogle = window.adsbygoogle || []).push({});

  </script>
</div>

希望它有用!

关于html - 如何删除 AdSense 广告下方的空白区域?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33073203/

相关文章:

html - 如何强制使用 100% 宽度的绝对位置以适应带有填充的父 div?

javascript - div中的li等间距用CSS或JS

html - HTML 头部中样式表声明的属性顺序差异

html - 奇怪的字体或标题问题在 Chrome 中消失了

javascript - 响应式 HTML/CSS TreeView

html - 移动浏览器与桌面浏览器字体大小的区别

javascript - CSS 动画无法启动

html - 动态创建的表格在非IE浏览器中显示无效

css - :not(:last-of-type) not working for class

html - 只有最后一个 href 有效