Google adsense responsive ad

Making the Google adsense banner ad responsive for my current project has proven very frustrating. Nothing worked. It either broke the width of the screen and remained at 728px wide on mobile, stayed at 320px on laptop or was 1pxwide x 90px high and other such fun times.

Finally after reading up heaps and choosing one of the responsive choices google lists: style=”display:inline-block;min-width:320px;max-width:728px;width:100%;height:90px” I was ready to finally conquer this annoying fiend.
itDoesCompute_google-adsense_01
I needed the ad to float right of the logo full screen and fall in underneath the logo on mobile devices. To make this work though you need a combo of two things:

1. the adsense div (in my case “adsenseBanner”) must have a width so the ad knows what it’s size is relative to.
itDoesCompute_google-adsense_02
2. media queries to resize the div and thus the ad according to chosen break points:
itDoesCompute_google-adsense_03
Although the ad is not technically ‘responsive’ (it doesnt fluidly flow through ratio changes with manual resizing) it will listen to media queries and display accordingly.
itDoesCompute_google-adsense_04
I still have to style in some centering of the image and ad as you can see…
itDoesCompute_google-adsense_05

So now @media query portrait:
itDoesCompute_google-adsense_06
and @media query landscape:
itDoesCompute_google-adsense_07