Pau*_*sen 11 html adsense responsive-design
我正在使用自适应广告.默认情况下,文字广告很好地左对齐,但由于某种原因,图片广告的左边距非常宽.我无法摆脱它,即使我采用最简单的页面,即只有一个广告的页面:
<!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>
Run Code Online (Sandbox Code Playgroud)
文字广告左对齐,例如:
但图片广告包含一些较宽的左边距,例如:
我的问题是如何确保图片广告左对齐?
尝试将其放入容器中,并给容器 amax-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>
Run Code Online (Sandbox Code Playgroud)
如果没有可以尝试使用的测试页面,则很难解决。
试试这个 - 将你的 adsense 代码放在一个 div 中,并像这样设置 div 的样式:
<div style="margin: 5px !important; float: left !important;">
--Put your AdSense ad code here --
</div>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3913 次 |
| 最近记录: |