重要なお知らせ

「教えて! goo」は2025年9月17日(水)をもちまして、サービスを終了いたします。詳細はこちら>

電子書籍の厳選無料作品が豊富!

fc2ブログのサイドバーに正方形のアドセンス広告を貼りたいのですが、どのようにしたら良いでしょうか?

初心者なので推奨デザインから選びたいのですが、
レスポンシブデザインを選ぶと縦長の広告になってしまいますし、レクタングル(300×250)を選ぶと(今これにしています)大きすぎるようで横が切れています。

宜しくお願いいたします。

A 回答 (2件)

自分でレスポンシブ対応すれば出来る。



「自動サイズ」と書かれたユニットがあるのでこれを選択。

①下の様なコードが取得できる。
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- テスト -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-xxx"
data-ad-slot="xxx"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

②↓下の様に手直しする

<style> ←追加
.adslot_1 { width: 200px; height: 100px; } ←追加、widthで幅を設定
</style> ←追加
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- adslot_1 -->
<ins class="adsbygoogle adslot_1" ←追加 adslot_1を後ろに追加
style="display:inline-block"
data-ad-client="ca-pub-xxx"
data-ad-slot="xxx"></ins> ←data-ad-format="auto"は削除
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
    • good
    • 0
この回答へのお礼

ありがとうございます!助かりました!

お礼日時:2017/01/16 17:37

style="display:block"も


style="display:inline-block" に修正する。
    • good
    • 0
この回答へのお礼

こんな方法もあるのですね。ありがとうございました!

お礼日時:2017/01/16 17:37

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!