Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Responsive Adsense Unit Breaking Bootstrap Panel

How do I prevent Adsense responsive unit placed similar to the code below from breaking out of the panel? In my experience the banner breaks the pannel and takes full width. The code used for Adsense responsive unit is the default code provided by Google.

<div class="col-md-12" style="padding-top:20px;">
    <div class="panel panel-default panel-profile m-b-md">
        <div class="panel-body text-center" style="padding: 5px 0 5px 0">
            <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
            <!-- Thank You -->
            <ins class="adsbygoogle"
                 style="display:block;"
                 data-ad-client="ca-pub-xxxxxx"
                 data-ad-slot="xxxxxx"
                 data-ad-format="auto"></ins>
            <script>
                (adsbygoogle = window.adsbygoogle || []).push({});
            </script>
        </div>
    </div>
</div>

actual pageYour assistance is appreciated.

like image 265
Techy Avatar asked Jul 10 '17 16:07

Techy


1 Answers

I have set up a Plunker test and to me everything looks ok: https://plnkr.co/edit/YTVHcR2SjMdEPyaM0Owa?p=preview

<!DOCTYPE html>
<html>

<head>
  <link data-require="[email protected]" data-semver="3.3.7" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
  <script data-require="[email protected]" data-semver="2.2.4" src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
  <script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
  <script data-require="[email protected]" data-semver="3.3.7" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <link rel="stylesheet" href="style.css" />
  <script src="script.js"></script>
  <script>
    $(document).ready(function() {
      (adsbygoogle = window.adsbygoogle || []).push({})
    })
  </script>
</head>

<body>
  <h1>Hello Plunker!</h1>
  <div class="col-md-12" style="padding-top:20px;">
    <div class="panel panel-default panel-profile m-b-md">
      <div class="panel-body text-center" style="padding: 5px 0 5px 0">
        <!-- adsense responsive unit code -->
        <ins class="adsbygoogle" data-ad-client="ca-pub-9482555242423991" data-ad-slot="1928867468" data-ad-format="auto"></ins>
      </div>
    </div>
  </div>
</body>

</html>

CSS:

.adsbygoogle {
  display: inline-block;
  width:100%;
  overflow: hidden;
}
like image 69
Gerfried Avatar answered Oct 25 '22 09:10

Gerfried