How to vertically center Google ad?

4 replies
  • WEB DESIGN
  • |
I am not an WordPress expert and I am afraid of messing up with Google Adsense code by myself. I want to vertically allign (center) Google Adsense ad. Google code is like this:

Code:
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js">
Some google stuff...
</script>
#center #google #vertically
  • Profile picture of the author jbyte
    Your best bet would be to wrap <center></center> tags around the javascript.
    Are you using a cms for your site?
    Signature

    I fix WordPress problems, PM me if you need help

    {{ DiscussionBoard.errors[9848111].message }}
    • Profile picture of the author SpaceSerbian
      Originally Posted by jbyte View Post

      Your best bet would be to wrap <center></center> tags around the javascript.
      Are you using a cms for your site?
      Well "center" tag will align it horizontally, I am looking for a vertical centering. I am using a Wordpress.
      {{ DiscussionBoard.errors[9848222].message }}
  • Profile picture of the author JosephI
    Should work for you. Enclose the script in a div id.

    div id { position: relative; top: 50%; transform: translateY(-50%); }
    {{ DiscussionBoard.errors[9849142].message }}

Trending Topics