gpt4 book ai didi

html - 如何左对齐响应式 Adsense 图片广告?

转载 作者:技术小花猫 更新时间:2023-10-29 12:51:16 25 4
gpt4 key购买 nike

我正在使用自适应 Adsense 广告。默认情况下,文字广告很好地左对齐,但由于某种原因,图片广告的左边距非常宽。我无法摆脱它,即使我采用最简单的页面,即上面只有广告的页面:

<!DOCTYPE html>
<html>
<head>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
</head>
<body>
<!-- Responsive Ad -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="xxx"
data-ad-slot="xxx"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</body>
</html>

文字广告左对齐,例如:

enter image description here

但图片广告包含一些较宽的左边距,例如:

enter image description here

我的问题是如何确保图片广告左对齐?

最佳答案

试着把它放在一个容器中,并给容器一个max-width,也许还有text-align: left

<!DOCTYPE html>
<html>
<head>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
</head>
<body>
<!-- Responsive Ad -->
<div id="ad" style="width: 100%; max-width: 600px; text-align: left;">
<ins class="adsbygoogle"
style="display:block"
data-ad-client="xxx"
data-ad-slot="xxx"
data-ad-format="auto"></ins>
</div>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</body>
</html>

如果没有可以试玩的测试页,则很难解决。

关于html - 如何左对齐响应式 Adsense 图片广告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32172063/

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