I use the same html for both desktop and mobile version of my site, with a different css.

The problem is the 728x90 leaderboard that doesn't fit into my mobile version layout.

Is there a suggested way (by Google) to replace the 728 with a smaller adsense banner?


I think I've asked this question over a year ago on Google groups but I did not get answer. You could try CSS media queries. If width of device is less than 800px, show different adsense code (and hide default one).

| improve this answer | |
  • CSS media queries can't replace the adsense code. They can replace the styles. You would need to use some jQuery to recognize say the ID or Class being shown and if it were a mobile class then display the mobile ads instead of desktop. – Anagio Dec 13 '12 at 21:06
  • I thought this way: You have two divs: one for desktop ad code and one for mobile ad code. by default mobile ad code div has display: none but if device width is less than 800px then we add display: none to desktop div and display: block to mobile div... – Juris Malinens Dec 14 '12 at 19:48
  • @Juris it is almost certainly against Adsense TOS to hide adverts. Blame Google for being way behind the times with Adsense. – DisgruntledGoat Dec 18 '12 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.