自分のはてなブログに広告を表示したくてアドセンスを使用しています。
その広告をDivで囲んでオシャレにしたいのですが、レスポンシブ広告がDivからはみ出たり、はみでなかったりします。
試行錯誤しましたが、私の感触では読み込むタイミングで再現しなかったりしたりするっぽいのですが、
何か解決策はありますでしょうか。
はてなブログの仕組み的にHTMLのすぐ後に書くことはできないのでJSで移動させています。
ご有識者の方よろしくお願いいたします。
html
1 2<style type="text/css"> 3 /*adsense*/ 4 div.gads { 5 width: 99%; 6 background-color: rgba(11, 13, 17, 0.6); 7 border-radius:5px; 8 margin-bottom:15px; 9 text-align: center; 10 color: rgba(166, 180, 183, 0.94); 11 padding: 4px; 12 } 13</style> 14 15<div id="entry-footer-secondary-modules">ここの後に表示したい</div> 16 17<script> 18 addEventListener("DOMContentLoaded", function() { 19 var $target = $('#entry-footer-secondary-modules'); 20 $target.eq(0).after($('.foot-adsense')); 21 }, false); 22</script> 23<div class="foot-adsense"> 24 <div class="gads"> 25 <span style="font-size: 85%;">Sponsored Link</span> 26 <div><ins class="adsbygoogle" 27 style="display:block; text-align:center;" 28 data-ad-format="fluid" 29 data-ad-layout="in-article" 30 data-ad-client="ca-pub-xxxxxxxxxx" 31 data-ad-slot="xxxxxxxxx"></ins> 32 <script> 33 (adsbygoogle = window.adsbygoogle || []).push({}); 34 </script> 35 </div> 36 </div> 37</div> 38
あなたの回答
tips
プレビュー