@@ -276,3 +276,66 @@ button {
276276 opacity : 0 !important ;
277277 transition : none !important ;
278278}
279+
280+ /* ==============================================================
281+ Google AdSense 固定幅はみ出し防止(モバイル対応)
282+ - スマホで広告がビューポート幅より大きくなって右スクロールが発生する問題を防止
283+ - 既存の UI / UX に収まるように広告要素の最大幅をビューポート幅に制限する
284+ - 特定の要素(ins.adsbygoogle, iframe)をターゲットにし、強制的に overflow を抑える
285+ ============================================================== */
286+
287+ /* 基本制約(全画面サイズ共通) */
288+ .adsbygoogle ,
289+ ins .adsbygoogle ,
290+ .adsbygoogle > ins ,
291+ iframe [src *= "pagead2.googlesyndication.com" ] {
292+ max-width : 100% !important ;
293+ box-sizing : border-box !important ;
294+ overflow : hidden !important ;
295+ display : block !important ;
296+ margin-left : auto !important ;
297+ margin-right : auto !important ;
298+ }
299+
300+ /* 広告を内包するコンテナがある場合に備える */
301+ .ad-container ,
302+ .adsense-container ,
303+ .ads-wrapper {
304+ max-width : 100% !important ;
305+ width : 100% !important ;
306+ overflow : hidden !important ;
307+ box-sizing : border-box !important ;
308+ }
309+
310+ /* 汎用 iframe のはみ出し防止(念のためサイト全体で適用) */
311+ iframe {
312+ max-width : 100% !important ;
313+ }
314+
315+ /* モバイル(小さい画面)向けの強化ルール */
316+ @media (max-width : 480px ) {
317+ .adsbygoogle ,
318+ ins .adsbygoogle ,
319+ .ad-container ,
320+ .adsense-container {
321+ width : 100% !important ;
322+ min-width : 0 !important ;
323+ height : auto !important ;
324+ max-width : 100% !important ;
325+ word-break : break-word !important ;
326+ }
327+
328+ /* 広告内の iframe にも適用 */
329+ iframe [src *= "pagead2.googlesyndication.com" ] {
330+ width : 100% !important ;
331+ min-width : 0 !important ;
332+ max-width : 100% !important ;
333+ height : auto !important ;
334+ }
335+ }
336+
337+ /* 注意:
338+ - AMP 風や自動レスポンシブ広告(data-ad-format="auto" 等)を使っている場合は、
339+ AdSense 設定側で「レスポンシブ」設定を有効にするのが最も良い。
340+ - ここでは CSS 側で横にはみ出さないように抑える対処を行っています。
341+ */
0 commit comments