Align adsense to center

7 replies
  • WEB DESIGN
  • |
I want to align my top banner to center and just above the content (welcome to style & decor)
Stylish Blinds - Largest Window Blinds Manufacturer In Karachi, Pakistan
#adsense #align #center
  • Profile picture of the author helfgott
    Originally Posted by opportunist86 View Post

    I want to align my top banner to center and just above the content (welcome to style & decor)...
    put the <script> code into a div first, something like this:

    <div class="ads_top">
    <script>adsense code</script>
    </div>

    In the CSS sheet:

    div.ads_top {
    margin-left:auto;
    margin-right:auto;
    text-align:center;
    }

    I usually use this technique and works fine, if doesn't just let us know to provide other solution
    {{ DiscussionBoard.errors[4722435].message }}
    • Profile picture of the author positivethinking
      This is right solution.
      Originally Posted by helfgott View Post

      put the <script> code into a div first, something like this:

      <div class="ads_top">
      <script>adsense code</script>
      </div>

      In the CSS sheet:

      div.ads_top {
      margin-left:auto;
      margin-right:auto;
      text-align:center;
      }

      I usually use this technique and works fine, if doesn't just let us know to provide other solution
      {{ DiscussionBoard.errors[4726801].message }}
  • Profile picture of the author Robert Michael
    All I do is place the <center> tags around the adsense code.

    So for example, it would be like

    <center> Adsense code here </center>

    But that probably wont put it at the top.. The post above mine sounds like it will work though.
    {{ DiscussionBoard.errors[4722463].message }}
    • Profile picture of the author helfgott
      Originally Posted by Whos That Guru View Post

      All I do is place the <center> tags around the adsense code.

      So for example, it would be like

      <center> Adsense code here </center>
      Is a good suggestion, but as i understand <center> ussage is deprecated.
      {{ DiscussionBoard.errors[4722471].message }}
  • Profile picture of the author opportunist86
    thanks whos that guru!
    it worked! How can I align my content a little bit up?
    {{ DiscussionBoard.errors[4722597].message }}
  • Profile picture of the author Robert Michael
    Now that, I have no idea about.. On my site builder you can just drag your block to where you want it. I think the 2nd post in this thread (by helfgott) might work for that part though (if you know how to edit the CSS and all that stuff, which I do not. LOL)

    Good luck!
    {{ DiscussionBoard.errors[4722636].message }}
  • Profile picture of the author helfgott
    Originally Posted by opportunist86 View Post

    thanks whos that guru!
    it worked! How can I align my content a little bit up?
    You want to avoid that "white space" between content and "top banner" right?

    Try to avoid <center> ussage, as i said it is deprecated, i'm taking a look over your code, and you could make some wraps to gain control over design.

    And the "Adsense banner" should be into the body not out:


    <body>
    <center> <script type="text/javascript"><!-- google_ad_clien..... </script></center>
    </body>

    After that try to wrap all like this:

    <body>

    <div id="wrap_all">
    <div id="wrap_header">
    <center> <script type="text/javascript"><!-- google_ad_clien.....</script></center>
    <div>
    <div id="wrap_content">
    The rest of your content
    </div>
    <div id="wrap_footer">
    Stuff at the end of the page
    </div>

    </div>


    </body>

    Apply in CSS:

    #wrap_content {

    top:-12px;

    }

    Also you should use an external CSS file instead embed code.
    {{ DiscussionBoard.errors[4722743].message }}

Trending Topics