javascript - 您如何调整谷歌广告的大小并将其保存在 DIV 中并使其不大于 DIV?
问题描述
我将展示广告作为我的谷歌广告单元(响应式)。我希望 google 生成的广告包含在 350x250 DIV 容器中。然而,目前,当谷歌生成一个 160x600 的广告时,即使我my-ad
说 div 框应该是 350x250。我怎样才能解决这个问题?
.my-ad {
max-height: 300px;
max-width: 250px;
min-height: 0px;
min-width: 0px;
}
<div class="my-ad">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-CENSORED"
data-ad-slot="CENSORED"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
解决方案
如果您希望您的插槽不大于 300x250,那么我觉得您不应该使用响应式。例如,在移动响应式广告上,全宽通常大于 300 像素。
您是否考虑过只投放固定尺寸的广告?例如像这样:https ://support.google.com/adsense/answer/9183363?hl=en
推荐阅读
- swiftui - App 变得活跃差异(2 例)——SwiftUI
- google-signin - 谷歌“一键”,gsi/status 返回格式错误的 json 响应
- python - 如何将数据从一个数据帧映射到另一个数据帧的列?
- python - Pandas groupby变换最大解决方案?
- signalr - 使用 SignalR 发布数据?
- python - 类对象被误认为是 int
- python - 如何从python中的文本文件制作嵌套字典?
- javascript - 无法使用 formik 在 material-ui 中更改我的文本字段值
- java - 无法在 Android Studio 中选择 Java
- cassandra - 无法连接到 cassandra 中的端口