[英]How can I limit the resize scale of a div so it cant get bigger than the parent div
[英]How do you resize a google ad and keep it inside a DIV and make it not bigger than the 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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.