• My site is detroitghetto dot com, and I’m trying to center some adsense codes in a text widget area. The theme is on the Genesis framework and is the Midnight child theme. I’m trying to center the 250×250 square ad below the photo gallery, and the 728×90 banner at the bottom. I’ve tried several different methods already, none of which have worked. I’ve searched here and on goggle and have tried what others have already suggested for centering adsense codes within a widget. I’ve tried the following:

    <center>adsense code</center>

    <div align=”center”>adsense code</div>

    <span style=”text-align:center;”><table border=0
    align=”center”><tr><td><table align=”center” border=0
    cellpadding=”1″><tr><td>adsense code</td></tr></table></
    td></tr></table></span>

    I”ve tried adding this code to the bottom of my css file:

    #googleAd { text-align: center; }

    Any suggestions?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Most of what you have tried is deprecated or incorrect code. Without seeing the site, it’s very hard to say very specifically, but this may be helpful:

    https://www.w3schools.com/css/css_align.asp

    Thread Starter jimmydean19

    (@jimmydean19)

    Thank you for the reply. Which section of my code would you suggest I look at:

    /* Home Widget Areas
    ------------------------------------------------------------ */
    
    #home-widget-areas {
    	margin: 0 auto;
    	overflow: hidden;
    	width: 860px;
    }
    
    #home-widget-areas .home-left,
    #home-widget-areas .home-middle,
    #home-widget-areas .home-right {
    	width: 260px;
    }
    
    #home-widget-areas .home-left {
    	padding: 0 20px 0 0;
    }
    
    #home-widget-areas .home-middle {
    	border-left: 1px dotted #ccc;
    	border-right: 1px dotted #ccc;
    	padding: 0 20px;
    }
    
    #home-widget-areas .home-left,
    #home-widget-areas .home-middle {
    	float: left;
    }
    
    #home-widget-areas .home-right {
    	float: right;
    }
    
    #home-widget-areas .home-left .wrap,
    #home-widget-areas .home-middle .wrap,
    #home-widget-areas .home-right .wrap {
    	border: none;
    	padding: 0 30px;
    	text-align: center;
    }
    
    #home-widget-areas .widget {
    	margin: 0;
    	padding: 0;
    }
    
    #home-widget-areas p {
    	color: #888;
    	font-size: 12px;
    	line-height: 18px;
    }
    
    #home-widget-areas .more-link {
    	margin: 20px auto 0;
    }

    Depends on the html code — no way to say without seeing the site live.

    Thread Starter jimmydean19

    (@jimmydean19)

    My site is detroitghetto dot com

    Thread Starter jimmydean19

    (@jimmydean19)

    bump…

    To center the footer ad — change the width of #footer-widgets to 740px — line 1569

    To center the ad in the middle of the page, try adding this to the CSS:

    #text-9 {
       margin-left: -20px
    }

    You might need to adjust that negative margin a bit.

    And don’t bump — it’s against the forum rules.

    Thread Starter jimmydean19

    (@jimmydean19)

    Thanks for the reply. I tried both things you suggested but neither worked.
    I just figured out how to center the adsense ad in the footer, by modifying this:

    #footer-widgets .wrap {
    	margin: 0 auto;
    	overflow: hidden;
    	padding: 20px 0 0;
    	width: 704px;
    }

    I changed the width from 900 to 800, then 700 and finally 704 seems to be about center.

    For the 250×250 square ad under the photo gallery in the home middle widget area, I modified this:

    #home-widget-areas .home-left .wrap,
    #home-widget-areas .home-middle .wrap,
    #home-widget-areas .home-right .wrap {
    	border: none;
    	padding: 0 30px;
    	text-align: center;
    }

    I changed the padding to 1px and my ad is now centered, but the photo gallery photo icons above it are now too far to the left. Any suggestions?

    And sorry about the bump, didn’t know it was against the rules.

    `<div align = “center”>
    <script type=”text/javascript”><!–
    google_ad_client = “#”;
    /* Header Ad */
    google_ad_slot = “#”;
    google_ad_width = 728;
    google_ad_height = 90;
    //–>
    </script>
    <script type=”text/javascript”
    src=”#”>
    </script>
    </div>’

    This is the exact code I use in my widget text area. I just center each ad. I don’t bother messing with the .css file

    Thread Starter jimmydean19

    (@jimmydean19)

    This is the exact code I use in my widget text area. I just center each ad. I don’t bother messing with the .css file

    Trust me, I’d use this code too if it worked for me, but as I mentioned in my first post that’s not working.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Need help centering adsense code’ is closed to new replies.