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 center align adsense ads?

Discussion in 'Placement / Reviews / Examples' started by Ellora, Oct 20, 2006.

  1. #1
    Hi,

    I have a site coded in xhtml/css, where I use the 468x60 adsense banner.

    Immediately below the adsense banner is a h2 heading

    I would like the adsense ad to center align. I used

    
    <div style="display:block; float: left; margin: 0px 50px 0px px;"> 
    Code (markup):
    But with this, the h2 heading wraps around the adsense banner.

    How do I fix this problem?

    Any suggestions would be greatly appreciated.

    Thank you,
    Ellora.
     
    Ellora, Oct 20, 2006 IP
  2. JRJR

    JRJR Active Member

    Messages:
    172
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #2
    What about <center>[adsense code]</center>?

    I use it in some ads of my website and it's working.
     
    JRJR, Oct 20, 2006 IP
  3. Y2K

    Y2K Peon

    Messages:
    193
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Try this code
    <div align="center" style="display:block; float: left; margin: 0px 50px 0px px;">
    Code (markup):
    I think if you paste more code here,there will help us to solve your problem.
     
    Y2K, Oct 20, 2006 IP
  4. sensik

    sensik Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    text-align: center;
    Code (markup):
    may work as well.
     
    sensik, Oct 20, 2006 IP
  5. danfirst

    danfirst Active Member

    Messages:
    450
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #5
    Yep easiest is to just use <center></center>.
     
    danfirst, Oct 20, 2006 IP
  6. stackman

    stackman Peon

    Messages:
    840
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #6
    If you're trying to center your Adsense block in other text, use a 3-column table and insert your Adsense code in the middle column. You can also try CSS.
     
    stackman, Oct 21, 2006 IP
  7. SeanMck

    SeanMck Peon

    Messages:
    122
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #7
    <div align="center">ADSENSE CODE</div>
    Code (markup):
    Easiest and best way, I use it on my sites all the time.
     
    SeanMck, Oct 21, 2006 IP
  8. wealthymum

    wealthymum Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I have tried using <div align="center">ADSENSE CODE</div> to align my ad but no luck, can someone help with the positioning of this line please.


    <script type="text/javascript"> <!--
    google_ad_client = "pub-xxxxxxxxx";
    /* 600x250header */google_ad_slot = "8438039169";
    google_ad_width = 1000;
    google_ad_height = 100;
    //-->
    </script><div align="center">ADSENSE CODE</div>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
     
    Last edited: Mar 27, 2009
    wealthymum, Mar 27, 2009 IP
  9. sdas

    sdas Peon

    Messages:
    189
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Hi,
    Use <center>Your AdSense Code</center>
     
    sdas, Mar 28, 2009 IP
  10. nspstudio

    nspstudio Peon

    Messages:
    203
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    <center>
    <script type="text/javascript"> <!--
    google_ad_client = "pub-4283123004553695";
    /* 600x250header */google_ad_slot = "8438039169";
    google_ad_width = 1000;
    google_ad_height = 100;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </center>
     
    nspstudio, Mar 28, 2009 IP
  11. squeezeplaycards

    squeezeplaycards Peon

    Messages:
    260
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #11
    I needed help with that too. Thanks!
     
    squeezeplaycards, May 1, 2009 IP
  12. truivia

    truivia Active Member

    Messages:
    467
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #12
    make sure your cell and table properties are correct too or this won't work
     
    truivia, May 1, 2009 IP
  13. Querall

    Querall Peon

    Messages:
    381
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #13
    <center>[adsense code]</center> is work on my site..you should too..
     
    Querall, Nov 14, 2010 IP
  14. Elitegeek

    Elitegeek Peon

    Messages:
    325
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #14
    <center> AD SENSE CODE (Copied from your Google AdSense Account) </center>

    That should do it mate. Hope it helps!
     
    Elitegeek, Nov 15, 2010 IP
  15. hemantthecorporater

    hemantthecorporater Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    <center>ADSENSE CODE</center>
    is the perfect, best and simplest option..
     
    hemantthecorporater, Nov 23, 2012 IP
  16. Jatelo2

    Jatelo2 Member

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #16
    It has just worked for me.. thanks
     
    Jatelo2, Apr 14, 2014 IP
  17. RobinInTexas

    RobinInTexas Active Member

    Messages:
    217
    Likes Received:
    14
    Best Answers:
    2
    Trophy Points:
    65
    #17
    The <center> tag is not supported in HTML5

    Add this to your css

    .center {
    margin-left: auto;
    margin-right: auto;
    }
    Use this HTML:

    <div class="center">ADSENSE CODE</div>

    This should work for quite some time in the future and <center> will eventually be depreciated.

     
    RobinInTexas, Apr 14, 2014 IP
  18. N.Patel

    N.Patel Member

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    43
    #18
    Try this:

    <div align="center">[ad-code]</div>
    <div align="left">
    Rest of content....
    </div>
     
    N.Patel, Apr 21, 2014 IP
  19. jfseostudio.com

    jfseostudio.com Well-Known Member

    Messages:
    142
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    128
    #19
    <center> AdSense Code</center>
     
    jfseostudio.com, Apr 17, 2020 IP
  20. Hatim123+

    Hatim123+ Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #20
    I searched a lot to tinker with the alignment of ads. Finally stumbled upon 2 sites that gave me the solution. First is this one and second one is https://www.infinityfolder.com/make-affiliate-banners-and-display-ads-align-center-html-code/

    Both of them can be the solution
     
    Last edited: Mar 28, 2023
    Hatim123+, Mar 28, 2023 IP