Centering Google Ads

Discussion in 'CSS' started by warsome, Apr 20, 2008.

  1. #1
    Alright, so, I'm having a lot of trouble centering my google ad's. The way I've been told to do it is to use:
    #advertisement {   margin-left: auto;
      margin-right: auto; }
    Code (markup):
                <div id="advertisement">ADSENSECODEHERE</div>
    
    Code (markup):
    However, that isn't working.

    Any other methods?

    (I'm using Adsense Image Ad's.)
     
    warsome, Apr 20, 2008 IP
  2. Boris4ka

    Boris4ka Well-Known Member

    Messages:
    172
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    110
    #2
    That seems like the correct code, so since it doesn't work try:

    <div align="center">adsensecodehere</div>

    or

    <center>adsensecodehere</center>

    Both ways are XHTML 1.0 valid.

    Edit: you can also try replacing the # in your code with a period ( . ) and changing the "id" to "class"

    so it would be:

    .advertisement{...}
    <div class="advertisement">...</div>
     
    Boris4ka, Apr 20, 2008 IP
  3. warsome

    warsome Guest

    Messages:
    500
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I found out that the way to solve it is:
    text-align: center;

    Instead of all that Auto Margin mumbo-Jumbo.

    So, it's fixed :D
     
    warsome, Apr 20, 2008 IP
  4. vidal

    vidal Well-Known Member

    Messages:
    186
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    145
    #4
    css code:
    body {text-align:center}
    #container {width:900px;margin:0 auto} (but you ads in this div)
     
    vidal, Apr 21, 2008 IP