1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How do I make ad unit height lower?

Discussion in 'AdSense' started by jag1, Dec 14, 2019.

  1. #1
    Hello

    I have been trying for so long to make my mobile ads height lower because i want a mobile banner ad but it doesnt matter what I edit in the code, the ads height will always be 312px height. This is the ad code I use:

    <div>
    <script async src='https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'></script>
    <ins class='adsbygoogle'
    style='display:block; height: 180px'
    data-ad-client='ca-pub-123
    data-ad-slot='123'
    data-ad-format='auto'
    overlays='false'
    data-full-width-responsive='true'>
    </ins>
    <script>
    (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </div>

    I hope that someone could help me with this. The old ad unit creater on adsense was much easier to understand than the todays system
     
    jag1, Dec 14, 2019 IP
    JEET likes this.
  2. qwikad.com

    qwikad.com Illustrious Member Affiliate Manager

    Messages:
    7,151
    Likes Received:
    1,656
    Best Answers:
    29
    Trophy Points:
    475
    #2
    No sure if it makes a huge difference, but I'd use double quotes (the way it's generated). I am wondering if display:block is what's hindering the height. Try this code:
    
    
    <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <ins class="adsbygoogle"
         style="display:inline-block;width:200px;height:180px"
         data-ad-client="ca-pub-123"
         data-ad-slot="123"></ins>
    <script>
         (adsbygoogle = window.adsbygoogle || []).push({});
    </script> 
    
    
    Code (markup):
     
    qwikad.com, Dec 14, 2019 IP
    JEET likes this.
  3. JEET

    JEET Notable Member

    Messages:
    3,825
    Likes Received:
    502
    Best Answers:
    19
    Trophy Points:
    265
    #3
    I think you need to set max-height in the style attribute, like this:

    style="display:block;height:180px;max-height:180px;overflow:scroll;"

    You can use overflow:hidden as well.
     
    JEET, Dec 14, 2019 IP
  4. jag1

    jag1 Greenhorn

    Messages:
    25
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    13
    #4
    Thank you guys bit i cannot get this to work :/ when trying all of your examples, No ad is shown what so ever
    Any more ideas?
     
    jag1, Jan 4, 2020 IP