Welcome to WebmasterWorld Guest from 54.146.221.231

Forum Moderators: incrediBILL & martinibuster

Message Too Old, No Replies

How to Set Height for Responsive Smart Size Ads?

Width is auto adjustable but can height be set

     
6:28 pm on Jan 9, 2014 (gmt 0)

Junior Member from CA 

10+ Year Member

joined:Oct 1, 2002
posts: 61
votes: 3


I'm currently using the advanced settings Adsense code with @media to set Adsense width and height on my responsive site eg. (750w by 200h) (300by250) - that works fine

I tried the smart size ad code and the ad units showed fine at various widths with their container div set to 100% - however the height does not seem to be adjustable (seemed to be stuck on 90px). Tried setting height:200px in the ad container div css but all it did was leave a bottom white space.

Any one know if the smart size code can specify a height?
9:57 am on Jan 23, 2014 (gmt 0)

Preferred Member

joined:June 10, 2011
posts: 519
votes: 0


I got the same issue as you described.
12:33 am on Jan 24, 2014 (gmt 0)

Full Member

5+ Year Member

joined:Feb 13, 2008
posts:239
votes: 0


I changed it to text ads only and this issue is resolved now
10:34 am on Jan 24, 2014 (gmt 0)

Preferred Member

joined:June 10, 2011
posts: 519
votes: 0


It's not an option if you want image and text ads.
8:45 am on Feb 14, 2014 (gmt 0)

Preferred Member

joined:June 10, 2011
posts: 519
votes: 0


I found a solution. It is quite simple.

<div style="width:100%; display: inline-block">

AD CODE HERE

</div>
2:41 pm on Feb 14, 2014 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:Aug 1, 2013
posts:1293
votes: 6


For a bit more control over smart sized ads, the following values are available for the following line in the Smart Size script (per Google)

data-ad-format="auto">


These options are available

data-ad-format="rectangle">

data-ad-format="vertical">

data-ad-format="horizontal">


Added: This helps prevent problems like getting a 600 pixel tall ad in a space where you only want a horizontal banner or square ad. Also has the effect of forcing taller ad units where you want them. Keep in mind this is scaling to the size of the container. You can also try setting the max-width and max-height of your containers to control how much space the ad consumes.
3:08 pm on Feb 14, 2014 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 18, 2002
posts:2283
votes: 3


@webcentric Thanks! very helpful. :)