Welcome to WebmasterWorld Guest from 54.167.213.22

Forum Moderators: not2easy

Message Too Old, No Replies

Center Adsense in Wordpress theme

     
6:39 pm on Jan 15, 2011 (gmt 0)

5+ Year Member



Hi all I have a theme that Im trying to center a google adsense leaderboard in. It was built for navigation but Ive just placed my Adsense code there and its all to the left. I want it in the center Any help please?

Here is the CSS

#sec-nav {
width:1000px;
display:block;
float:left;
background:#fff;
border-bottom:1px solid #fff;
height:28px;
padding:0;
}

#sec-nav ul {
list-style:none;
color:#000;
font-family:Helvetica Neue,Helvetica,Arial,FreeSans,sans-serif;
height:28px;
}

#sec-nav li {
padding:6px 4px 2px 4px;
float:left;
list-style:none;
margin:0;
}

#sec-nav li a {
text-decoration:none;
text-transform:uppercase;
font-size:12px;
font-weight:700;
color:#000000;
margin:1px 0 0 18px;
}

#sec-nav li a:hover {
color:#B00000;
}

there is no navigation in this area id like to just place my adsense code there and center it within page.

Here is the Header.php Code

<?php $td_sec_menu_check = get_option('td_sec_menu_check'); if($td_sec_menu_check): ?>
<div id="sec-nav">
<ul>
<li>
<?php $td_sec_menu_code = get_option('td_sec_menu_code'); echo stripslashes($td_sec_menu_code); ?>
</li>
</ul>
</div>



Any ideas?

Thanks in advance
10:24 am on Jan 19, 2011 (gmt 0)

WebmasterWorld Senior Member suzyuk is a WebmasterWorld Top Contributor of All Time 10+ Year Member



there's some unnecessary CSS in your sample but in the interest of not fickering with your theme, I think the best thing is for you to insert a <div> with a class so you can isolate/CSS just that div.. then center it as required.. e.g.



#sec-nav .asen {
background: #cfc;
width: 500px; /* same as or slightly wider than the adsense leaderboard */
margin: 0 auto; /* will center if a width is given */
}


<div id="sec-nav">
<ul>
<li>
<div class="asen">Adsense code in here</div>
</li>
</ul>
</div>
 

Featured Threads

Hot Threads This Week

Hot Threads This Month